mirror of
https://github.com/janet-lang/janet
synced 2025-07-07 12:32:55 +00:00
Fix some typos in boot.dst
This commit is contained in:
parent
1205ca5cad
commit
e4434f74b6
@ -105,7 +105,7 @@
|
|||||||
[])
|
[])
|
||||||
|
|
||||||
(defmacro if-not
|
(defmacro if-not
|
||||||
"Sorthand for (if (not ... "
|
"Shorthand for (if (not ... "
|
||||||
[condition exp-1 exp-2]
|
[condition exp-1 exp-2]
|
||||||
(tuple 'if condition exp-2 exp-1))
|
(tuple 'if condition exp-2 exp-1))
|
||||||
|
|
||||||
@ -115,7 +115,7 @@
|
|||||||
(tuple 'if condition (tuple-prepend body 'do)))
|
(tuple 'if condition (tuple-prepend body 'do)))
|
||||||
|
|
||||||
(defmacro when-not
|
(defmacro when-not
|
||||||
"Sorthand for (when (not ... "
|
"Shorthand for (when (not ... "
|
||||||
[condition & body]
|
[condition & body]
|
||||||
(tuple 'if condition nil (tuple-prepend body 'do)))
|
(tuple 'if condition nil (tuple-prepend body 'do)))
|
||||||
|
|
||||||
@ -272,7 +272,7 @@ evaluates to true."
|
|||||||
(aux 0))
|
(aux 0))
|
||||||
|
|
||||||
(defmacro default
|
(defmacro default
|
||||||
"Suplies a default argument when a value is nil."
|
"Supplies a default argument when a value is nil."
|
||||||
[sym default-value]
|
[sym default-value]
|
||||||
(tuple 'def sym (tuple 'or sym default-value)))
|
(tuple 'def sym (tuple 'or sym default-value)))
|
||||||
|
|
||||||
@ -368,7 +368,7 @@ Returns nil if args is empty."
|
|||||||
sa))
|
sa))
|
||||||
|
|
||||||
(defn reduce
|
(defn reduce
|
||||||
"Reduce, also know as foldleft in many languages, transforms
|
"Reduce, also know as fold-left in many languages, transforms
|
||||||
an indexed type (array, tuple) with a function to produce a value."
|
an indexed type (array, tuple) with a function to produce a value."
|
||||||
[f init ind]
|
[f init ind]
|
||||||
(var res init)
|
(var res init)
|
||||||
@ -407,7 +407,7 @@ the same type as the input sequence."
|
|||||||
|
|
||||||
(defn mapcat
|
(defn mapcat
|
||||||
"Map a function over every element in an array or tuple and
|
"Map a function over every element in an array or tuple and
|
||||||
use array concat to concatentae the results. Returns the same
|
use array to concatenate the results. Returns the same
|
||||||
type as the input sequence."
|
type as the input sequence."
|
||||||
[f ind t]
|
[f ind t]
|
||||||
(def res @[])
|
(def res @[])
|
||||||
@ -442,15 +442,15 @@ which (pred element) is truthy. Returns the same type as the input sequence."
|
|||||||
(if going nil i))
|
(if going nil i))
|
||||||
|
|
||||||
(defn find
|
(defn find
|
||||||
"Find the first value in an indexed collection that satsifies a predicate. Returns
|
"Find the first value in an indexed collection that satisfies a predicate. Returns
|
||||||
nil if not found. Note their is no way to differentiate a nil from the indexed collection
|
nil if not found. Note their is no way to differentiate a nil from the indexed collection
|
||||||
and a not found. Consider find-index if this is an issue."
|
and a not found. Consider find-index if this is an issue."
|
||||||
[pred ind]
|
[pred ind]
|
||||||
(get ind (find-index pred ind)))
|
(get ind (find-index pred ind)))
|
||||||
|
|
||||||
(defn take-until
|
(defn take-until
|
||||||
"Given a predicate, take only elements from an indexed type that satsify
|
"Given a predicate, take only elements from an indexed type that satisfy
|
||||||
the predicate, and abort on first failiure. Returns a new indexed type that is
|
the predicate, and abort on first failure. Returns a new indexed type that is
|
||||||
the same type as the input."
|
the same type as the input."
|
||||||
[pred ind t]
|
[pred ind t]
|
||||||
(def i (find-index pred ind))
|
(def i (find-index pred ind))
|
||||||
@ -464,8 +464,8 @@ the same type as the input."
|
|||||||
(take-until (complement pred) ind t))
|
(take-until (complement pred) ind t))
|
||||||
|
|
||||||
(defn drop-until
|
(defn drop-until
|
||||||
"Given a predicate, remove elements from an indexed type that satsify
|
"Given a predicate, remove elements from an indexed type that satisfy
|
||||||
the predicate, and abort on first failiure."
|
the predicate, and abort on first failure."
|
||||||
[pred ind t]
|
[pred ind t]
|
||||||
(def i (find-index pred ind))
|
(def i (find-index pred ind))
|
||||||
(if (= :tuple (type (or t ind)))
|
(if (= :tuple (type (or t ind)))
|
||||||
@ -583,7 +583,7 @@ in the same manner, and so on. Useful for expressing pipelines of data."
|
|||||||
(put coll a-key (apply a-function old-value args)))
|
(put coll a-key (apply a-function old-value args)))
|
||||||
|
|
||||||
(defn merge
|
(defn merge
|
||||||
"Merges mutliple tables/structs to one. If a key appears in more than one
|
"Merges multiple tables/structs to one. If a key appears in more than one
|
||||||
collection, then later values replace any previous ones.
|
collection, then later values replace any previous ones.
|
||||||
The type of the first collection determines the type of the resulting
|
The type of the first collection determines the type of the resulting
|
||||||
collection"
|
collection"
|
||||||
@ -834,7 +834,7 @@ network connection, etc. onvalue and onerr are callbacks that are
|
|||||||
invoked when a result is returned and when an error is produced,
|
invoked when a result is returned and when an error is produced,
|
||||||
respectively.
|
respectively.
|
||||||
|
|
||||||
This function can be used to implemement a repl very easily, simply
|
This function can be used to implement a repl very easily, simply
|
||||||
pass a function that reads line from stdin to chunks, and print to
|
pass a function that reads line from stdin to chunks, and print to
|
||||||
onvalue."
|
onvalue."
|
||||||
[env chunks onvalue onerr]
|
[env chunks onvalue onerr]
|
||||||
@ -954,8 +954,8 @@ onvalue."
|
|||||||
(apply tuple import* '_env path args))
|
(apply tuple import* '_env path args))
|
||||||
|
|
||||||
(defn repl [getchunk]
|
(defn repl [getchunk]
|
||||||
"Run a repl. The first paramets is an optional function to call to
|
"Run a repl. The first parameter is an optional function to call to
|
||||||
get a chunk of soure code. Should return nil for end of file."
|
get a chunk of source code. Should return nil for end of file."
|
||||||
(def newenv (make-env))
|
(def newenv (make-env))
|
||||||
(defn chunks [buf]
|
(defn chunks [buf]
|
||||||
(file-write stdout "> ")
|
(file-write stdout "> ")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user