mirror of
https://github.com/janet-lang/janet
synced 2024-11-24 17:27:18 +00:00
Tweak docstrings in boot.janet
This commit is contained in:
parent
1b6272db2e
commit
fce27cb2e8
@ -100,7 +100,7 @@
|
||||
(defn bytes? "Check if x is a string, symbol, keyword, or buffer." [x]
|
||||
(def t (type x))
|
||||
(if (= t :string) true (if (= t :symbol) true (if (= t :keyword) true (= t :buffer)))))
|
||||
(defn dictionary? "Check if x a table or struct." [x]
|
||||
(defn dictionary? "Check if x is a table or struct." [x]
|
||||
(def t (type x))
|
||||
(if (= t :table) true (= t :struct)))
|
||||
(defn indexed? "Check if x is an array or tuple." [x]
|
||||
@ -538,26 +538,26 @@
|
||||
Where binding is a binding as passed to def, :verb is one of a set of keywords,
|
||||
and object is any expression. The available verbs are:\n\n
|
||||
\t:iterate - repeatedly evaluate and bind to the expression while it is truthy.\n
|
||||
\t:range - loop over a range. The object should be two element tuple with a start
|
||||
\t:range - loop over a range. The object should be a two-element tuple with a start
|
||||
and end value, and an optional positive step. The range is half open, [start, end).\n
|
||||
\t:range-to - same as :range, but the range is inclusive [start, end].\n
|
||||
\t:down - loop over a range, stepping downwards. The object should be two element tuple
|
||||
\t:down - loop over a range, stepping downwards. The object should be a two-element tuple
|
||||
with a start and (exclusive) end value, and an optional (positive!) step size.\n
|
||||
\t:down-to - same :as down, but the range is inclusive [start, end].\n
|
||||
\t:keys - iterate over the keys in a data structure.\n
|
||||
\t:pairs - iterate over the keys value pairs as tuples in a data structure.\n
|
||||
\t:pairs - iterate over the key-value pairs as tuples in a data structure.\n
|
||||
\t:in - iterate over the values in a data structure.\n
|
||||
\t:generate - iterate over values yielded from a fiber. Can be paired with the generator
|
||||
function for the producer/consumer pattern.\n\n
|
||||
loop also accepts conditionals to refine the looping further. Conditionals are of
|
||||
the form:\n\n
|
||||
\t:modifier argument\n\n
|
||||
where :modifier is one of a set of keywords, and argument is keyword dependent.
|
||||
where :modifier is one of a set of keywords, and argument is keyword-dependent.
|
||||
:modifier can be one of:\n\n
|
||||
\t:while expression - breaks from the loop if expression is falsey.\n
|
||||
\t:until expression - breaks from the loop if expression is truthy.\n
|
||||
\t:let bindings - defines bindings inside the loop as passed to the let macro.\n
|
||||
\t:before form - evaluates a form for a side effect before of the next inner loop.\n
|
||||
\t:before form - evaluates a form for a side effect before the next inner loop.\n
|
||||
\t:after form - same as :before, but the side effect happens after the next inner loop.\n
|
||||
\t:repeat n - repeats the next inner loop n times.\n
|
||||
\t:when condition - only evaluates the loop body when condition is true.\n\n
|
||||
@ -818,8 +818,8 @@
|
||||
res)
|
||||
|
||||
(defn reduce2
|
||||
"The 2 argument version of reduce that does not take an initialization value.
|
||||
Instead the first element of the array is used for initialization."
|
||||
"The 2-argument version of reduce that does not take an initialization value.
|
||||
Instead, the first element of the array is used for initialization."
|
||||
[f ind]
|
||||
(var k (next ind))
|
||||
(if (= nil k) (break nil))
|
||||
@ -842,7 +842,7 @@
|
||||
ret)
|
||||
|
||||
(defn accumulate2
|
||||
"The 2 argument version of accumulate that does not take an initialization value."
|
||||
"The 2-argument version of accumulate that does not take an initialization value."
|
||||
[f ind]
|
||||
(var k (next ind))
|
||||
(def ret (array/new (length ind)))
|
||||
@ -2782,7 +2782,7 @@
|
||||
###
|
||||
|
||||
(defn- no-side-effects
|
||||
"Check if form may have side effects. If rturns true, then the src
|
||||
"Check if form may have side effects. If returns true, then the src
|
||||
must not have side effects, such as calling a C function."
|
||||
[src]
|
||||
(cond
|
||||
@ -2969,7 +2969,7 @@
|
||||
(do
|
||||
|
||||
(defn proto-flatten
|
||||
"Flatten a table and it's prototypes into a single table."
|
||||
"Flatten a table and its prototypes into a single table."
|
||||
[into x]
|
||||
(when x
|
||||
(proto-flatten into (table/getproto x))
|
||||
|
Loading…
Reference in New Issue
Block a user