mirror of
https://github.com/janet-lang/janet
synced 2025-10-24 20:27:41 +00:00
Fix some typos
This commit is contained in:
@@ -379,7 +379,7 @@ If no match is found, returns nil"
|
||||
|
||||
(defmacro when-let
|
||||
"Takes the first one or two forms in vector and if true binds
|
||||
all the forms with let and evaluates body"
|
||||
all the forms with let and evaluates the body"
|
||||
[bindings & body]
|
||||
(def head (ast-unwrap1 bindings))
|
||||
(tuple 'let head
|
||||
@@ -403,21 +403,21 @@ If no match is found, returns nil"
|
||||
(array-slice functions 5 -1)))))
|
||||
|
||||
(defn zipcoll
|
||||
"Creates an table or tuple from two arrays/tuples. Result is table if no
|
||||
third argument is given"
|
||||
"Creates an table or tuple from two arrays/tuples. If a third argument of
|
||||
:struct is givent resault is struct else is table."
|
||||
[coll-1 coll-2 the-type]
|
||||
(var zipping-table @{})
|
||||
(def {:more more1 :next next1} (iter coll-1))
|
||||
(def {:more more2 :next next2} (iter coll-2))
|
||||
(while (and (more1) (more2))
|
||||
(put zipping-table (next1) (next2)))
|
||||
(if (= :struct the-type)
|
||||
(if (struct? the-type)
|
||||
(table-to-struct zipping-table)
|
||||
zipping-table))
|
||||
|
||||
(defn update
|
||||
"Accepts a key argument and passes its associated value to a function.
|
||||
The key, then is associated to that value"
|
||||
"Accepts a key argument and passes its' associated value to a function.
|
||||
The key then, is associated to the function's return value"
|
||||
[coll a-key a-function & args]
|
||||
(def old-value (get coll a-key) )
|
||||
(put coll a-key (apply a-function old-value args)))
|
||||
|
||||
Reference in New Issue
Block a user