mirror of
https://github.com/janet-lang/janet
synced 2025-04-08 00:06:38 +00:00
Fix some typos in boot.dst
This commit is contained in:
parent
1205ca5cad
commit
e4434f74b6
@ -105,7 +105,7 @@
|
||||
[])
|
||||
|
||||
(defmacro if-not
|
||||
"Sorthand for (if (not ... "
|
||||
"Shorthand for (if (not ... "
|
||||
[condition exp-1 exp-2]
|
||||
(tuple 'if condition exp-2 exp-1))
|
||||
|
||||
@ -115,7 +115,7 @@
|
||||
(tuple 'if condition (tuple-prepend body 'do)))
|
||||
|
||||
(defmacro when-not
|
||||
"Sorthand for (when (not ... "
|
||||
"Shorthand for (when (not ... "
|
||||
[condition & body]
|
||||
(tuple 'if condition nil (tuple-prepend body 'do)))
|
||||
|
||||
@ -272,7 +272,7 @@ evaluates to true."
|
||||
(aux 0))
|
||||
|
||||
(defmacro default
|
||||
"Suplies a default argument when a value is nil."
|
||||
"Supplies a default argument when a value is nil."
|
||||
[sym default-value]
|
||||
(tuple 'def sym (tuple 'or sym default-value)))
|
||||
|
||||
@ -368,7 +368,7 @@ Returns nil if args is empty."
|
||||
sa))
|
||||
|
||||
(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."
|
||||
[f init ind]
|
||||
(var res init)
|
||||
@ -407,7 +407,7 @@ the same type as the input sequence."
|
||||
|
||||
(defn mapcat
|
||||
"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."
|
||||
[f ind t]
|
||||
(def res @[])
|
||||
@ -442,15 +442,15 @@ which (pred element) is truthy. Returns the same type as the input sequence."
|
||||
(if going nil i))
|
||||
|
||||
(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
|
||||
and a not found. Consider find-index if this is an issue."
|
||||
[pred ind]
|
||||
(get ind (find-index pred ind)))
|
||||
|
||||
(defn take-until
|
||||
"Given a predicate, take only elements from an indexed type that satsify
|
||||
the predicate, and abort on first failiure. Returns a new indexed type that is
|
||||
"Given a predicate, take only elements from an indexed type that satisfy
|
||||
the predicate, and abort on first failure. Returns a new indexed type that is
|
||||
the same type as the input."
|
||||
[pred ind t]
|
||||
(def i (find-index pred ind))
|
||||
@ -464,8 +464,8 @@ the same type as the input."
|
||||
(take-until (complement pred) ind t))
|
||||
|
||||
(defn drop-until
|
||||
"Given a predicate, remove elements from an indexed type that satsify
|
||||
the predicate, and abort on first failiure."
|
||||
"Given a predicate, remove elements from an indexed type that satisfy
|
||||
the predicate, and abort on first failure."
|
||||
[pred ind t]
|
||||
(def i (find-index pred 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)))
|
||||
|
||||
(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.
|
||||
The type of the first collection determines the type of the resulting
|
||||
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,
|
||||
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
|
||||
onvalue."
|
||||
[env chunks onvalue onerr]
|
||||
@ -954,8 +954,8 @@ onvalue."
|
||||
(apply tuple import* '_env path args))
|
||||
|
||||
(defn repl [getchunk]
|
||||
"Run a repl. The first paramets is an optional function to call to
|
||||
get a chunk of soure code. Should return nil for end of file."
|
||||
"Run a repl. The first parameter is an optional function to call to
|
||||
get a chunk of source code. Should return nil for end of file."
|
||||
(def newenv (make-env))
|
||||
(defn chunks [buf]
|
||||
(file-write stdout "> ")
|
||||
|
Loading…
x
Reference in New Issue
Block a user