Control Flow Statements
Last Week Homework "Stack" Solution
Function pointer (函式指標)
Static Class Members (靜態類別成員)
Constructor & Destructor (建構子與解構子)
Class Templates (類別樣板)
This document appears to be notes from a presentation on Clojure. It discusses key features of Clojure like how it differs from Lisp, its use of REPL for documentation, lambda functions and macros. A large portion of the document covers concurrency in Clojure, explaining concepts like STM, atoms and agents. It provides examples of using Clojure's STM functions like ref, deref, alter and compares them to handling concurrency in other languages like Scala. The notes conclude by mentioning side-effects and comparing Clojure to other JVM languages.
Control Flow Statements
Last Week Homework "Stack" Solution
Function pointer (函式指標)
Static Class Members (靜態類別成員)
Constructor & Destructor (建構子與解構子)
Class Templates (類別樣板)
This document appears to be notes from a presentation on Clojure. It discusses key features of Clojure like how it differs from Lisp, its use of REPL for documentation, lambda functions and macros. A large portion of the document covers concurrency in Clojure, explaining concepts like STM, atoms and agents. It provides examples of using Clojure's STM functions like ref, deref, alter and compares them to handling concurrency in other languages like Scala. The notes conclude by mentioning side-effects and comparing Clojure to other JVM languages.
The document discusses pattern matching and predicate dispatch in dynamic programming languages. It notes that dynamic typing can lead to errors, and that traditional object-oriented typing is often too coarse-grained. The document proposes an approach using pattern matching and predicate dispatch to specify allowed types and behaviors more precisely without static types. It describes compiling pattern matching to decision trees, how patterns are implemented as protocols, and provides examples of pattern matching for sequences, maps, and using guards.
Macros are essential in Clojure and are used to provide fundamental operations like "when". Macros receive unevaluated code and return data structures for Clojure to evaluate. Writing macros involves building lists to represent code. Care must be taken to avoid issues like variable capture and double evaluation. While powerful, macros can lead to overly complex code if overused.
This document summarizes Carlo Sciolla's presentation on Clojure given to the Amsterdam Clojurians. Sciolla discusses his background and motivation for exploring functional programming. He then provides an introduction to Clojure, explaining its Lisp roots and key concepts like immutable data structures, sequences, and the read-eval-print loop. Sciolla also gives an example function to count the letters in a string to demonstrate how real problems can be solved in Clojure despite its immutable design.
The document discusses refactoring code that sends different types of requests to a server using macros. Initially, a function is used to send requests, but it results in duplicate code. A macro is then used to generate code for sending different request types in a generic way. However, using a symbol for the parameter map causes issues at compile time, since the macro evaluator does not know the runtime values. The macro is updated to accept a list of expected parameter fields to generate setting code for each one. This allows the parameter map to remain a symbol without needing its runtime value.
Continuation Passing Style and Macros in Clojure - Jan 2012Leonardo Borges
?
The document discusses continuation-passing style (CPS) in Clojure, where control is passed explicitly as a continuation argument to each function, and provides examples of implementing the Pythagorean theorem and Fibonacci sequence in CPS; it also explains how macros can be used to avoid deep nesting when accessing nested values and demonstrates a macro for this use case.
This document provides recommendations for commonly used development tools on Mac, including recommendations for the terminal, command line tools, version control with Git, Java tools, Clojure tools, Mac apps, and Emacs configurations. It also asks the audience to provide additional tool recommendations.
Direct linking in Clojure 1.8 allows functions to make direct static method calls to other functions for improved performance, bypassing lookups through vars. It does this by compiling functions with direct calls instead of going through the var and Fn object. However, direct linking cannot see redefinitions and doesn't work with libraries like with-redefs that rely on redefining functions. Functions can be marked with ^:redef to prevent direct linking.
Stefan Richter - Writing simple, readable and robust code: Examples in Java, ...AboutYouGmbH
?
Stefan Richter gave a presentation on writing simple, readable, and robust code using examples in Java, Clojure, and Go. He discussed his programming experience and showed how Martin Fowler used Java to parse a fixed-length file format into objects. Richter then demonstrated how the same task could be accomplished more concisely in Common Lisp and Clojure using macros to define domain-specific languages. He argued that macros are a powerful feature of Lisp-like languages.
This document introduces Elixir, an open-source, functional, concurrent, and dynamic language that runs on the Erlang virtual machine. It discusses key features of Elixir like its Ruby-like syntax, support for distributed and fault-tolerant systems, actor model, macros, protocols, and tools. It also provides examples of functional programming, pattern matching, actors, GenServers, supervisors, macros, protocols, and sigils in Elixir.
This document provides a summary of Jacek Laskowski as the main sponsor of a Clojure conference. It lists his background and experience including being a functional apprentice of Clojure, founder and co-leader of a JUG, conference organizer, member of Apache Software Foundation and IBM. It also lists his blog and Twitter accounts.
Macros are functions that are supplied with Clojure and defined by users. Argument forms are passed as data to the macro function, which returns a new data structure as a replacement for the macro call. Many things that are built-in to other languages are implemented as macros in Clojure.
This document provides a summary of an introduction to the Clojure programming language. It discusses what Clojure is, its timeline and adoption, functional programming concepts, concurrency features using Software Transactional Memory, the Lisp ideology it is based on including homoiconicity and its macro system. It also provides an overview of getting started with Clojure including using the REPL, basic syntax like symbols and keywords, data types, sequences, functions, and Java interoperability. Resources for learning more about Clojure are also listed.
Talk about DSL, How to write DSL in Clojure, How to use Instaparse (simplest library for parsing grammars) and how we use Clojure and Instaparse in Zoomdata
在此課程中將帶領對資料分析感到陌生卻又充滿興趣的您,完整地學會運用 R 語言從最初的蒐集資料、探索性分析解讀資料,並進行文字探勘,發現那些肉眼看不見、隱藏在資料底下的意義。此課程主要設計給對於 R 語言有基本認識,想要進一步熟悉實作分析的朋友們,希望在課程結束後,您能夠更熟悉 R 語言這個豐富的分析工具。透過蘋果日報慈善捐款的資料集,了解如何從頭解析網頁,撰寫爬蟲自動化收集資訊;取得資料後,能夠靈活處理資料,做清洗、整合及探索;並利用現成的套件進行文字探勘、文本解析;我們將一步步實際走一回資料分析的歷程,處理、觀察、解構資料,試著看看人們在捐款的決策過程中,究竟是什麼因素產生了影響,以及這些結果又是如何從資料中挖掘而出的呢?
This document summarizes Erlang processes and scheduling in Erlang. It discusses the process control block, stack and heap, message passing, the scheduler, workload balancing across schedulers, and garbage collection. The scheduler prioritizes ports, maximum, high and normal/low priority queues. It will consume all reductions for a process or pause it waiting for a message. The garbage collector uses copying collection for process heaps and reference counting for shared binaries.
The document discusses CPU caches and cache coherence. It covers direct mapping and N-way mapping of CPU caches. It also discusses cache replacement policies like LRU and techniques like write-back. It introduces the MESI protocol for maintaining cache coherence across CPUs and cache line states like dirty valid. It provides examples of Java programs to demonstrate CPU cache misses and false sharing and ways to address it like using the @Contended annotation.
This document summarizes an agenda for a 2015 AV technology sharing session. It discusses Instaparse, a Clojure parser generator, EBNF grammar notation, defining functions with pattern matching using defun, and Cloud Query Language (CQL) for translating SQL-like queries to MongoDB queries. Examples are provided for parsing arithmetic expressions, defining recursive functions, pattern matching on collections, visualizing parses trees, and transforming parses queries to MongoDB queries. Performance of the CQL parser is discussed, noting it can achieve over 400 queries per second per node through caching.
Hystrix is a latency and fault tolerance library designed by Netflix to isolate points of access to remote systems and services. It stops failures from cascading and improves resilience. Hystrix uses concepts like thread pooling, timeouts, circuit breakers, and fallbacks to achieve reliability. It provides commands for synchronous and asynchronous access to remote resources, and can be configured using properties or code. Hystrix also includes a dashboard for monitoring metrics and failures.