diff options
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. |