Delete anaphoric
docstrings
so they don't get desynchronized from the manual.
This commit is contained in:
parent
c7966920a6
commit
08abdd5af9
@ -12,13 +12,10 @@
|
||||
|
||||
|
||||
(defmacro ap-each [xs &rest body]
|
||||
"Evaluate the body form for each element in the list."
|
||||
(rit `(for [it ~xs] ~@body)))
|
||||
|
||||
|
||||
(defmacro ap-each-while [xs form &rest body]
|
||||
"Evaluate the body form for each element in the list while the
|
||||
predicate form evaluates to True."
|
||||
(rit `(for [it ~xs]
|
||||
(unless ~form
|
||||
(break))
|
||||
@ -26,41 +23,33 @@
|
||||
|
||||
|
||||
(defmacro ap-map [form xs]
|
||||
"Yield elements evaluated in the form for each element in the list."
|
||||
(rit `(gfor it ~xs ~form)))
|
||||
|
||||
|
||||
(defmacro ap-map-when [predfn rep xs]
|
||||
"Yield elements evaluated for each element in the list when the
|
||||
predicate function returns True."
|
||||
(rit `(gfor it ~xs (if (~predfn it) ~rep it))))
|
||||
|
||||
|
||||
(defmacro ap-filter [form xs]
|
||||
"Yield elements returned when the predicate form evaluates to True."
|
||||
(rit `(gfor it ~xs :if ~form it)))
|
||||
|
||||
|
||||
(defmacro ap-reject [form xs]
|
||||
"Yield elements returned when the predicate form evaluates to False"
|
||||
(rit `(gfor it ~xs :if (not ~form) it)))
|
||||
|
||||
|
||||
(defmacro ap-dotimes [n &rest body]
|
||||
"Execute body for side effects `n' times, with it bound from 0 to n-1"
|
||||
(rit `(for [it (range ~n)]
|
||||
~@body)))
|
||||
|
||||
|
||||
(defmacro ap-first [form xs]
|
||||
"Yield the first element that passes `form`"
|
||||
(rit `(next
|
||||
(gfor it ~xs :if ~form it)
|
||||
None)))
|
||||
|
||||
|
||||
(defmacro ap-last [form xs]
|
||||
"Yield the last element that passes `form`"
|
||||
(setv x (gensym))
|
||||
(rit `(do
|
||||
(setv ~x None)
|
||||
@ -70,7 +59,6 @@
|
||||
|
||||
|
||||
(defmacro! ap-reduce [form o!xs &optional [initial-value None]]
|
||||
"Anaphoric form of reduce, `acc' and `it' can be used for a form"
|
||||
(recur-sym-replace {'it (gensym) 'acc (gensym)} `(do
|
||||
(setv acc ~(if (none? initial-value)
|
||||
`(do
|
||||
@ -83,14 +71,6 @@
|
||||
|
||||
|
||||
(deftag % [expr]
|
||||
"Makes an expression into a function with an implicit `%` parameter list.
|
||||
|
||||
A `%i` symbol designates the (1-based) ith parameter (such as `%3`).
|
||||
Only the maximum `%i` determines the number of `%i` parameters--the
|
||||
others need not appear in the expression.
|
||||
`%*` and `%**` name the `&rest` and `&kwargs` parameters, respectively.
|
||||
|
||||
Nesting of `#%` forms is not recommended."
|
||||
(setv %symbols (sfor a (flatten [expr])
|
||||
:if (and (symbol? a)
|
||||
(.startswith a '%))
|
||||
|
Loading…
Reference in New Issue
Block a user