Welcome, I'm happy to see you here! Feel free to pick a function and add a happy example, the more the merrier!
(defn knorkulate [a b ]
(tracev (+ a (* b b ))))
# <function knorkulate>
(knorkulate 2 34 )
# trace on line 2, column 1: (+ a (* b b)) is 1158
# 1158 (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
# on a Core i5-4590:
(os/arch ) # => :x64
# on an Intel Atom N270:
(os/arch ) # => :x86
# on a raspberry pi:
(os/arch ) # => :arm (keyword "" )
# => : # janet 1.10.1
(pos? 1 ) # => true
(pos? 1.618 ) # => true
(pos? 0 ) # => false
(pos? -1 ) # => false
(def pi 3.14159 )
(pos? pi ) # => true
(pos? nil ) # => true
(pos? false ) # => true
(pos? "hello" ) # => true
(pos? :heyo ) # => true
(pos? [-1 ]) # => true
(pos? {:a 1 }) # => true
(pos? (fn [])) # => true
(one? (math/next 1 math/inf )) # => false (let [seed 0 ]
(= (math/rng-uniform (math/rng seed ))
(math/rng-uniform (math/rng seed ))))
# => true
(map |($ {:a 7 :b 8 } ) [ keys values kvs pairs ])
# => @[ @[:a :b] @[7 8] @[:a 7 :b 8] @[(:a 7) (:b 8)] ]
(map |($ [4 5 6 ] ) [ keys values kvs pairs ])
# => @[ @[0 1 2] @[4 5 6] @[0 4 1 5 2 6] @[(0 4) (1 5) (2 6)] ]
(map |($ 'ab ) [ keys values kvs pairs ])
# => @[ @[0 1] @[97 98] @[0 97 1 98] @[(0 97) (1 98)] ]
(map |($ :ab ) [ keys values kvs pairs ])
# => @[ @[0 1] @[97 98] @[0 97 1 98] @[(0 97) (1 98)] ]
(map |($ "ab" ) [ keys values kvs pairs ])
# => @[ @[0 1] @[97 98] @[0 97 1 98] @[(0 97) (1 98)] ]
(math/log (* math/e math/e )) # => 2
(math/log2 256 ) # => 8
(math/log10 1000 ) # => 3
new Math.seedrandom('hello.');(os/cryptorand 1 ) # => @"\n"
(os/cryptorand 1 ) # => @"<"
(os/cryptorand 1 ) # => @"\xC0"
(os/cryptorand 1 ) # => @"\x89"
(os/cryptorand 8 ) # => @"\x87\x13\x99\x95\x10su\e"
(odd? 2 ) # => false
(odd? nil ) # throws an error
(odd? 1 ) # => true
(odd? "a" ) # => throws an error # opens a file named filename for writing, and writes Hello World!
(def f (file/open "filename" :w ))
(file/write f "Hello World!" )
(file/flush f )
(file/close f )(def request {:params {:id 1 }}) # => {:params {:id 1}}
(get-in request [:params :id ]) # => 1
(get-in request [:params :name ]) # => nil
(get-in request [:params :name ] "N/A" ) # => "N/A" (spit "/tmp/hello.sh" "#!/bin/bash\necho 'Hello from Bash!'\n" )
(os/chmod "/tmp/hello.sh" "rwx------" )
(os/setenv "PATH" (string (os/getenv "PATH" ) ":/tmp" ))
(os/shell "hello.sh" )