diff options
| author | Andrey Orst <andreyorst@gmail.com> | 2020-10-24 15:26:39 +0300 |
|---|---|---|
| committer | Andrey Orst <andreyorst@gmail.com> | 2020-10-24 15:26:39 +0300 |
| commit | 83af7d7e9ffe3ae32e2cffbf59d204d3809ffe70 (patch) | |
| tree | f7253f281d74a6960484f2f4389c2b78f321dc1d /README.org | |
| parent | 76c5475a43d5c21b6b3e7fa00bf04bd94341f690 (diff) | |
more functions
Diffstat (limited to 'README.org')
| -rw-r--r-- | README.org | 11 |
1 files changed, 9 insertions, 2 deletions
@@ -100,6 +100,7 @@ Much like =if-let= and =when-let=, except tests expression for =nil=. #+end_src *** =into= +<<into>> Clojure's =into= function implemented as macro, because Fennel has no runtime distinction between =[]= and ={}= tables, since Lua also doesn't feature this feature. However we can do this at compile time. @@ -152,7 +153,7 @@ Full set can be examined by requiring the module. *** =seq= =seq= produces a sequential table from any kind of table in linear time. -Works mostly like in Clojure, but, since Fennel doesn't have list object, it always returns sequential tables: +Works mostly like in Clojure, but, since Fennel doesn't have list object, it returns sequential table or =nil=: #+begin_src fennel (seq [1 2 3 4 5]) @@ -160,9 +161,15 @@ Works mostly like in Clojure, but, since Fennel doesn't have list object, it alw (seq {:a 1 :b 2 :c 3 :d 4}) ;; [["d" 4] ["a" 1] ["b" 2] ["c" 3]] + + (seq []) + ;; nil + + (seq {}) + ;; nil #+end_src -See [[*=into=][=into=]] on how to transform such sequence back into associative table. +See [[into][into]] on how to transform such sequence back into associative table. *** =first= and =rest= =first= returns first value of a table. |