From 83af7d7e9ffe3ae32e2cffbf59d204d3809ffe70 Mon Sep 17 00:00:00 2001 From: Andrey Orst Date: Sat, 24 Oct 2020 15:26:39 +0300 Subject: more functions --- README.org | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'README.org') diff --git a/README.org b/README.org index 7949fb2..4ddaf56 100644 --- a/README.org +++ b/README.org @@ -100,6 +100,7 @@ Much like =if-let= and =when-let=, except tests expression for =nil=. #+end_src *** =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. -- cgit v1.2.3