Welcome, I'm happy to see you here! Feel free to add a happy example, the more the merrier!
(from-pairs [[:hello "world" ] [:foo "bar" ]])
# => @{:foo "bar" :hello "world"} # convert a string to an integer
(peg/match '(number :d+ ) "123" )
#=> @[123]
(first (peg/match '(number :d+ ) "123" ))
#=> 123 # `parse` can decode arbitrary JDN (Janet Data Notation) encoded by `string/format`
(def encoded (string/format "%j" @{:a 123 :b "foo" :c @{1 [1.2 2.3 3.4 ]}}))
# => "@{:a 123 :b \"foo\" :c @{1 @[1.2 2.2999999999999998 3.3999999999999999]}}"
(parse encoded )
# => @{:a 123 :b "foo" :c @{1 @[1.2 2.3 3.4]}} (os/which ) # => :macos (from-pairs [[:a 1 ] [:b 2 ]])
# => @{:a 1 :b 2} (< ) # -> true
(< 1 ) # -> true
(< 1 2 ) # -> true
(< 2 1 ) # -> false
(< 1 2 3 ) # -> true
(< 1 3 2 ) # -> false
[1 2 3 ] # => (1 2 3)
(tuple/type [1 2 3 ]) # => :parens
(tuple/brackets 1 2 3 ) # => [1 2 3]
(tuple/type (tuple/brackets 1 2 3 )) # => :brackets
(zipcoll [:a :b :c ] [1 2 3 ]) #=> @{:c 3 :a 1 :b 2} (map nil? [nil 0 false [] ])
# => @[true false false false]
(let [seed 0 ]
(= (math/rng-uniform (math/rng seed ))
(math/rng-uniform (math/rng seed ))))
# => true
math/int32-max # => 2147483647
(import spork/charts :as c )
(import spork/gfx2d :as g )
(g/save "bla.png" (c/plot-line-graph
:canvas (g/blank 100 100 )
:data {:timestamp [1 2 3 40 5 60 ]
:temperature-1 [75.1 75.2 75.4 75.5 75.5 75.4 ]
:temperature-2 [55.1 55.4 55.7 60.0 60.4 60.9 ]}
:x-column :timestamp
:y-column [:temperature-1 :temperature-2 ]))
# then you can look at bla.png (defn return-nil [x ] nil )
(-?> 1 inc ) # -> 2
(-?> 1 inc inc ) # -> 3
(-?> 1 inc inc return-nil ) # -> nil
(-?> 1 inc inc return-nil inc ) # -> nil
(abstract? (file/temp )) # => true
(abstract? (int/s64 1 )) # => true
(map abstract? [ nil true 97 'a :a "a" ])
# => @[false false false false false false]
(map abstract? [ [97 ] @[97 ] {0 97 } @{0 97 } ])
# => @[false false false false]
(map abstract? [ even? loop file/open (fn []) ])
# => @[false false false false]
(map abstract? [ (file/temp ) (fiber/new (fn [])) ])
# => @[true false]
(partition-by even? [1 1 2 3 5 8 13 21 ])
# => @[@[1 1] @[2] @[3 5] @[8] @[13 21]]
(map bytes? [ 'ab :ab "ab" @"ab" [97 98 ] @[97 98 ] {0 97 1 98 } @{0 97 1 98 } ])
# => @[ true true true true false false false false ]
(map symbol? [ 'ab :ab "ab" @"ab" [97 98 ] @[97 98 ] {0 97 1 98 } @{0 97 1 98 } ])
# => @[ true false false false false false false false ]
(map keyword? [ 'ab :ab "ab" @"ab" [97 98 ] @[97 98 ] {0 97 1 98 } @{0 97 1 98 } ])
# => @[ false true false false false false false false ]
(map string? [ 'ab :ab "ab" @"ab" [97 98 ] @[97 98 ] {0 97 1 98 } @{0 97 1 98 } ])
# => @[ false false true false false false false false ]
(map buffer? [ 'ab :ab "ab" @"ab" [97 98 ] @[97 98 ] {0 97 1 98 } @{0 97 1 98 } ])
# => @[ false false false true false false false false ] (peg/match ~{:main (capture (some :S ))}
"hello world" )
# => @["hello"] (math/hypot 1 1 ) # => 1.41421
(math/sqrt 2 ) # => 1.41421
(chr "a" ) # => 97 (defn slurp-lines [path ]
(string/split "\n" (slurp path )))