These are the outline slides that I used for the Pune Clojure Course.
The slides may not be much useful standalone, but I have uploaded them for reference.
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Pune Clojure Course Outline
1.
2.
3. Programming Language Nerd
Co-founder & CTO, Infinitely Beta
Clojure programmer since the early
days
Curator of Planet Clojure
Author of “Clojure in Practice” (ETA
Sep, 2011)
5. Created by Rich Hickey in
2007
Open Sourced in 2008
First large deployment in Jan,
2009
Second in Apr, same year
We’ve come a long way since
then!
6. Programming languages OO is overrated
haven’t really changed
much Polymorphism is good
Creating large-scale, Multi-core is the future
concurrent software is
still hard VMs are the next-gen
platforms
Functional Programming
rocks Ecosystem matters
Lisp is super power Dynamic development
9. There is no other syntax!
Data structures are the code
No other text based syntax, only different
interpretations
Everything is an expression (s-exp)
All data literals stand for themselves, except symbols &
lists
11. “It is better to have 100 functions operate on one data structure
than 10 functions on 10 data-structures.”
Alan J. Perlis
12. An abstraction over traditional Lisp lists
Provides an uniform way of walking through different
data-structures
Sample sequence functions seq
first
rest
filter
remove
for
partition
reverse
sort
map
reduce
doseq
13. Analogous to Java packages, but with added dynamism
A mapping of symbols to actual vars/classes
Can be queried and modified dynamically
Usually manipulated via the ns macro
14. Data about data
Can annotate any symbol or collection
Mainly used by developers to mark data structures with
some special information
Clojure itself uses it heavily
(def
x
(with-‐meta
{:x
1}
{:source
:provider-‐1}))
-‐>
#’user/x
(meta
x)
-‐>
{:source
:provider-‐1}
15. Wrapper free interface to Java
Syntactic sugar makes calling Java easy & readable
Core Clojure abstractions are Java interfaces (will
change)
Clojure functions implement Callable & Runnable
Clojure sequence lib works with Java iterables
Near native speed
17. A technique of doing structural binding in a function
arg list or let binding
(defn
list-‐xyz
[xyz-‐map]
(list
(:x
xyz-‐map)
(:y
xyz-‐map)
(:z
xyz-‐map)))
(list-‐xyz
{:x
1,
:y
2
:z
3})
-‐>
(1
2
3)
18. //
From
Apache
Commons
Lang,
http://commons.apache.org/lang/
public
static
int
indexOfAny(String
str,
char[]
searchChars)
{
if
(isEmpty(str)
||
ArrayUtils.isEmpty(searchChars))
{
return
-‐1;
}
for
(int
i
=
0;
i
<
str.length();
i++)
{
char
ch
=
str.charAt(i);
for
(int
j
=
0;
j
<
searchChars.length;
j++)
{
if
(searchChars[j]
==
ch)
{
return
i;
}
}
}
return
-‐1;
}
21. (defn
indexed
[coll]
(map
vector
(iterate
inc
0)
coll))
(defn
index-‐filter
[pred
coll]
(when
pred
(for
[[idx
elt]
(indexed
coll)
:when
(pred
elt)]
idx)))
(index-‐filter
#{a
e
i
o
o}
"The
quick
brown
fox")
-‐>
(2
6
12
17)
(index-‐filter
#(>
(.length
%)
3)
["The"
"quick"
"brown"
"fox"])
-‐>
(1
2)
22. for
doseq
if
cond
condp
partition
loop
recur
str
map
reduce
filter
defmacro
apply
comp
complement
defstruct
drop
drop-‐last
drop-‐while
format
iterate
juxt
map
mapcat
memoize
merge
partial
partition
partition-‐all
re-‐seq
reductions
reduce
remove
repeat
repeatedly
zipmap
23. Simultaneous execution
Avoid reading; yielding inconsistent data
Synchronous Asynchronous
Coordinated ref
Independent atom
agent
Unshared var
24. Generalised indirect dispatch
Dispatch on an arbitrary function of the arguments
Call sequence
Call dispatch function on args to get dispatch value
Find method associated with dispatch value
Else call default method
Else error
26. A facility to extend the compiler with user code
Used to define syntactic constructs which would
otherwise require primitives/built-in support
(try-‐or
(/
1
0)
(reduce
+
[1
2
3
4])
(partition
(range
10)
2)
(map
+
[1
2
3
4]))