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