Welcome, I'm happy to see you here! Feel free to pick a function and add a happy example, the more the merrier!
(get (os/environ ) "HOME" ) # => "/Users/cell"
(os/getenv "HOME" ) # => "/Users/cell"
(-> @{:a 0 :b 0 }
(update :a inc )
(update :b inc ))
# => @{:a 1 :b 1}
(-> "X"
(string "a" "b" )
(string "c" "d" )
(string "e" "f" )) # => "Xabcdef" (sorted-by > @[1 2 3 4 5 6 7 8 9 10 11 12 ]) # => @[8 7 9 11 10 12 2 1 3 5 4 6]
(sorted-by < @[1 2 3 4 5 6 7 8 9 10 11 12 ]) # => @[8 7 9 11 10 12 2 1 3 5 4 6]
(sorted-by = @[1 2 3 4 5 6 7 8 9 10 11 12 ]) # => @[8 7 9 11 10 12 2 1 3 5 4 6]
(os/date )
# => {:month 6 :dst false :year-day 185 :seconds 38 :minutes 44 :week-day 6 :year 2020 :hours 4 :month-day 3} (tuple 1 2.3 :a "foo" true nil [] {} (fn []))
# => (1 2.3 :a "foo" true nil () {} <function 0x7FB2A3D030B0>)
(reduce (fn [s1 s2 ]
(string "[" s1 "+" s2 "]" ))
"x"
["a" "b" "c" ])
#=> "[[[x+a]+b]+c]"
# foo.txt is a file with contents "hello\nworld\n".
(slurp "foo.txt" ) # => @"hello\nworld\n"
(string/split "\n" (slurp "foo.txt" )) # => @["hello" "world" ""]
(defn slurp-lines [path ]
(string/split "\n" (slurp path )))
(slurp-lines "foo.txt" ) # => @["hello" "world" ""]
(string/join @["hello" "world" "" ] "\n" ) # => "hello\nworld\n"
(spit "foo2.txt" (string/join @["hello" "world" "" ] "\n" ))
# The contents of foo.txt and foo2.txt are now identical.
(defn spit-lines [path lines ]
(spit path (string/join lines "\n" )))
(spit-lines "foo3.txt" (slurp-lines "foo.txt" ))
# The contents of foo.txt and foo3.txt are now identical.
(os/perm-int "rw-r--r--" ) # => 420
(os/perm-int "rwxr-xr-x" ) # => 493
# note:
8r644 # => 420
8r755 # => 493
(int/u64 "18446744073709551615" )
# => <core/u64 18446744073709551615> (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 ] (math/ceil 1.1 ) # => 2
(map math/ceil [1.1 1.2 1.3 ]) # => @[2 2 2] (os/shell "uptime > /tmp/uptime.txt" ) # => 0
(slurp "/tmp/uptime.txt" )
# => @"22:33 up 5 days, 9:34, 15 users, load averages: 1.93 1.74 1.59\n"
(os/rm "/tmp/uptime.txt" ) # => nil (peg/find ':a "Battery temperature: 40 °C" )
# => 0 index of the first upper/lower case character
# :a (range "az" "AZ") (comment
# the content actually has to parse as janet
# this is ok
(+ 1 1 )
# => 2
# if there is something with missing delimiters though...
)