Welcome, I'm happy to see you here! Feel free to pick a function and add a happy example, the more the merrier!
(describe {:a 1 }) # => "<struct 0x5564AF1BD6C0>" (let (x @["This" "is" "a" ] # Must be array.
y @["test" "of" ]
z ["the" "emergency!" ]) # Tuple OK for part.
(pp (array/join x y z )))
# @["This" "is" "a" "test" "of" "the" "emergency!"] (doc string )
# => cfunction
# => ../src/core/corelib.c on line 349, column 1
# =>
# => (string & xs)
# =>
# => Creates a string by concatenating the elements of xs together. If
# => an element is not a byte sequence, it is converted to bytes via
# => describe. Returns the new string.
# nil (odd? 2 ) # => false
(odd? nil ) # throws an error
(odd? 1 ) # => true
(odd? "a" ) # => throws an error (blshift 8 2 ) # => 32 (def cc (ev/thread-chan 99 )) # Sets up a message channel.
(def ww (filewatch/new cc )) # Creates the watcher.
(filewatch/add ww "ftest.janet" :all ) # File to watch.
(filewatch/listen ww ) # Start filewatcher listening for changes.
(ev/spawn-thread # Spawn thread to catch change events.
(print "Waiting..." )
(forever (pp (ev/take cc ))))(string "hello " "world" ) # => "hello world"
(string "hello" nil true 42 :bar ) # => "helloniltrue42bar"
(string :a :b :c ) # => "abc"
(invert :yo )
# => @{111 1 121 0} (def cc (ev/thread-chan 99 )) # Sets up a message channel.
(def ww (filewatch/new cc )) # Creates the watcher.
(filewatch/add ww "ftest.janet" :all ) # Watch for all changes.
(filewatch/add ww "fadd.janet" :modify ) # Only care if modified (Linux-specific flag).
(filewatch/listen ww ) # Start filewatcher listening for changes.
(pp (ev/take cc )) # Print info on first file to change.
(filewatch/unlisten ww ) # Stop caring about changes. (os/shell "touch foo" )
(os/stat "foo" :modified ) # => 1593836002
(os/touch "foo" )
(os/stat "foo" :modified ) # => 1593836013 (sorted [1 -2 2 3 9 -10 ]) # @[-10 -2 1 2 3 9] # 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.
(eval-string "(+ 1 2 3 4)" ) # -> 10
(eval-string ")" ) # -> parse error
(eval-string "(bloop)" ) # -> compile error
(eval-string "(+ nil nil)" ) # -> runtime error (invert "yo" )
# => @{111 1 121 0}