Welcome, I'm happy to see you here! Feel free to pick a function and add a happy example, the more the merrier!
(flatten-into @[1 2 3 ] @[[4 5 6 ] @[7 8 9 ] @[10 11 12 ]]) # => @[1 2 3 4 5 6 7 8 9 10 11 12]
(math/exp2 8 ) # => 256
(type print )
# =>
:cfunction (math/hypot 1 1 ) # => 1.41421
(math/sqrt 2 ) # => 1.41421
(put @{:a 4 :b 5 } :c 6 ) # => @{:a 4 :b 5 :c 6}
(put @{:a 4 :b 5 } :b nil ) # => @{:a 4}
(put @{:a 4 :b 5 } :z nil ) # => @{:a 4 :b 5}
(put @[:a :b :c ] 0 :z ) # => @[:z :b :c]
(put @[:a :b :c ] 1 nil ) # => @[:a nil :c]
(put @[:a :b :c ] 5 :d ) # => @[:a :b :c nil nil :d]
(put @"hello" 0 "z" ) # error: can only put integers in buffers
(defn ord [ch ] (first (string/bytes ch )))
(ord "z" ) # => 122
(put @"hello" 0 122 ) # => @"zello"
(put @"hello" 0 (ord "z" ) ) # => @"zello"
(put @"hello" 8 (ord "y" ) ) # => @"hello\0\0\0y"
(assertf true "this sentence is %n" false )
# => true
(get default-peg-grammar :a )
# => '(range "az" "AZ") (update @{:a 1 } :a inc )
# => @{:a 2}
(bxor 2r011 2r110 )
# => 5
(let [len 8
rand-string (string/join (map |(string/format "%02x" $ )
(os/cryptorand len )))]
(= (length rand-string ) (* 2 len )))
# => true
(drop-while |(> 3 $ ) [0 1 2 3 4 5 6 7 8 ])
# => (3 4 5 6 7 8) (defn f1 [s ] (string "-" s "-" ))
(defn f2 [s ] (string "=" s "=" ))
(defn f3 [s ] (string "#" s "#" ))
(def f (juxt f1 f2 f3 ))
(f "x" ) # => ("-x-" "=x=" "#x#") (let [a 1 ]
(let [b a ]
b )) # => 1
new Math.seedrandom('hello.');(defn square [x ] (* x x ))
(defn square-then-dec [x ] ((comp dec square ) x ))
(defn dec-then-square [x ] ((comp square dec ) x ))
(square-then-dec 3 ) # => 8
(dec-then-square 3 ) # => 4