mirror of
https://github.com/janet-lang/janet
synced 2025-07-02 01:52:50 +00:00
Small changes to some doc strings.
This commit is contained in:
parent
7d49e3e6f1
commit
dde5351d11
@ -139,9 +139,9 @@
|
|||||||
[])
|
[])
|
||||||
|
|
||||||
(defmacro if-not
|
(defmacro if-not
|
||||||
"Shorthand for (if (not ... "
|
"Shorthand for (if (not condition) else then)."
|
||||||
[condition exp-1 &opt exp-2]
|
[condition then &opt else]
|
||||||
~(if ,condition ,exp-2 ,exp-1))
|
~(if ,condition ,else ,then))
|
||||||
|
|
||||||
(defmacro when
|
(defmacro when
|
||||||
"Evaluates the body when the condition is true. Otherwise returns nil."
|
"Evaluates the body when the condition is true. Otherwise returns nil."
|
||||||
@ -149,7 +149,7 @@
|
|||||||
~(if ,condition (do ,;body)))
|
~(if ,condition (do ,;body)))
|
||||||
|
|
||||||
(defmacro unless
|
(defmacro unless
|
||||||
"Shorthand for (when (not ... "
|
"Shorthand for (when (not condition) ;body). "
|
||||||
[condition & body]
|
[condition & body]
|
||||||
~(if ,condition nil (do ,;body)))
|
~(if ,condition nil (do ,;body)))
|
||||||
|
|
||||||
@ -171,7 +171,7 @@
|
|||||||
(defmacro case
|
(defmacro case
|
||||||
"Select the body that equals the dispatch value. When pairs
|
"Select the body that equals the dispatch value. When pairs
|
||||||
has an odd number of arguments, the last is the default expression.
|
has an odd number of arguments, the last is the default expression.
|
||||||
If no match is found, returns nil"
|
If no match is found, returns nil."
|
||||||
[dispatch & pairs]
|
[dispatch & pairs]
|
||||||
(def atm (idempotent? dispatch))
|
(def atm (idempotent? dispatch))
|
||||||
(def sym (if atm dispatch (gensym)))
|
(def sym (if atm dispatch (gensym)))
|
||||||
@ -416,7 +416,7 @@
|
|||||||
~(fiber/new (fn [] (loop ,head (yield (do ,;body)))) :yi))
|
~(fiber/new (fn [] (loop ,head (yield (do ,;body)))) :yi))
|
||||||
|
|
||||||
(defmacro coro
|
(defmacro coro
|
||||||
"A wrapper for making fibers. Same as (fiber/new (fn [] ...body) :yi)."
|
"A wrapper for making fibers. Same as (fiber/new (fn [] ;body) :yi)."
|
||||||
[& body]
|
[& body]
|
||||||
(tuple fiber/new (tuple 'fn '[] ;body) :yi))
|
(tuple fiber/new (tuple 'fn '[] ;body) :yi))
|
||||||
|
|
||||||
@ -678,7 +678,7 @@
|
|||||||
|
|
||||||
(defn find
|
(defn find
|
||||||
"Find the first value in an indexed collection that satisfies 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 there 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]
|
||||||
(def i (find-index pred ind))
|
(def i (find-index pred ind))
|
||||||
|
@ -266,7 +266,7 @@ static const JanetReg array_cfuns[] = {
|
|||||||
{
|
{
|
||||||
"array/ensure", cfun_array_ensure,
|
"array/ensure", cfun_array_ensure,
|
||||||
JDOC("(array/ensure arr capacity)\n\n"
|
JDOC("(array/ensure arr capacity)\n\n"
|
||||||
"Ensures that the memory backing the array has enough memory for capacity "
|
"Ensures that the memory backing the array is large enough for capacity "
|
||||||
"items. Capacity must be an integer. If the backing capacity is already enough, "
|
"items. Capacity must be an integer. If the backing capacity is already enough, "
|
||||||
"then this function does nothing. Otherwise, the backing memory will be reallocated "
|
"then this function does nothing. Otherwise, the backing memory will be reallocated "
|
||||||
"so that there is enough space.")
|
"so that there is enough space.")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user