instow

:)
git clone https://git.sr.ht/~ashymad/instow
Log | Files | Refs | LICENSE

utils.janet (316B)


      1 (defn some? [val]
      2   (not (nil? val)))
      3 
      4 (defmacro letsome [name val ifsome &opt ifnil]
      5   ~(let [,name ,val]
      6      (if (not (nil? ,name)) ,ifsome ,ifnil)))
      7 
      8 (defn rotate [ch str sz]
      9   (def nxt (+ sz (string/find ch str)))
     10   (if (= nxt (length str))
     11     (string/slice str 0 sz)
     12     (string/slice str nxt (+ nxt sz))))
     13 
     14