From dde6218bffb3fb76845d01142e6eb64d6b2ad658 Mon Sep 17 00:00:00 2001 From: Calvin Rose Date: Sun, 14 Oct 2018 23:08:06 -0400 Subject: [PATCH] Update lib files. --- lib/colors.janet | 2 +- lib/lazyseqs.janet | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/colors.janet b/lib/colors.janet index 23bf9c2d..226d54ac 100644 --- a/lib/colors.janet +++ b/lib/colors.janet @@ -38,4 +38,4 @@ (loop [[name color] :in (pairs colormap)] (defglobal (string.slice name 1) (fn color-wrapper [& pieces] - (string "\e[" color "m" (apply1 string pieces) "\e[0m")))) + (string "\e[" color "m" (apply string pieces) "\e[0m")))) diff --git a/lib/lazyseqs.janet b/lib/lazyseqs.janet index 1da1558d..592f2567 100644 --- a/lib/lazyseqs.janet +++ b/lib/lazyseqs.janet @@ -4,10 +4,11 @@ # that must be called (realizing it), and the memoized. # Use with (import "./path/to/this/file" :prefix "seq.") -(defmacro delay [& forms] +(defmacro delay "Lazily evaluate a series of expressions. Returns a function that returns the result of the last expression. Will only evaluate the body once, and then memoizes the result." + [& forms] (def $state (gensym)) (def $loaded (gensym)) (tuple 'do @@ -70,8 +71,9 @@ [s] (when (s) (realize (tail s)))) -(defn realize-map [f s] +(defn realize-map "Evaluate f on each member of the sequence. Forces evaluation." + [f s] (when (s) (f (head s)) (realize-map f (tail s)))) (defn drop