forked from nid90/clojurebridge-blr
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbridge.clj
83 lines (70 loc) · 1.49 KB
/
bridge.clj
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
(ns basic-clj-project.bridge)
;; writing all expressions here to evaluate in REPL
nil
1
2
(comment (print (eval (read))))
(quote (+ 1 (- 4 (* 2 5))))
'()
;; (loop (print (eval (read))))
true
;false
(prn "Hello World")
(+ 1 2)
(+ 1, 2)
(+ 1)
(+ 1,,,,, 2)
(+, 1, 2)
(+ 1 2 3 4 5 6 7)
'(+ 1 2)
(+ 3 4)
(+ 1 (- 4 (* 2 5)))
()
(class ())
'(1 2 3)
inc
'true
'"foo"
"foo"
(class 3/4)
(class nil)
(class \c)
(comment (+ "invalid number" 2))
:foo
inc
(conj [1 2 3] 4)
(conj [1 2 3] 4 5)
(conj [1 2 3] "foo")
(+ 1 2)
(comment (1 2 3 4))
((fn same [x] x) 42)
(let [x 1
y 1
z (+ x y)
z (* 2 z)]
(println z)
x)
{:first "Harry"
:middle "James"
:last "Potter"
:occupation "Auror"}
(assoc {:first "Hermione"} :last "Granger")
(dissoc {:first "Hermione" :last "Granger"} :last)
(merge {:first "Hermione"} {:last "Granger"})
(get {:first "Hermione" :last "Granger"} :first)
(get {:first "Hermione"} :last)
(get {:first "Hermione"} :last "NA")
(keys {:first "Hermione" :last "Granger"})
(vals {:first "Hermione" :last "Granger"})
(def hello {:count 1 :words "hello"})
(assoc hello :words "bye")
(update hello :count inc)
(update hello :words str ", world")
(def wizards [{:name "Harry Pooter"
:house "Gryffindor"}
{:name "Draco Malfoy"
:house "Slytherin"}])
(def houses {:gryffindor {:colors ["scarlet" "gold"]
:points 200}
:slytherin {:colors ["green" "silver"]
:points 150}})