mirror of
https://github.com/peklaiho/madlisp.git
synced 2024-11-22 21:35:03 +00:00
14 lines
340 B
Plaintext
14 lines
340 B
Plaintext
|
|
;;
|
|
;; Generic utility functions.
|
|
;;
|
|
|
|
;; Split string by whitespace, removing empty strings.
|
|
(defn split-ws (s) (re-split "/[\\s]+/" s))
|
|
|
|
;; Split string by whitespace into first and rest.
|
|
;; Useful for parsing a string for command name and arguments.
|
|
(defn str-first-rest (s)
|
|
(let (words (split-ws s))
|
|
[(first words) (tail words)]))
|