Update docs

master
Basil L. Contovounesios 9 years ago
parent f69a9df16f
commit 0273913927
No known key found for this signature in database
GPG Key ID: 205AB54A5D5D8CFF
  1. 75
      README.md
  2. 439
      dash.info
  3. 117
      dash.texi

@ -179,6 +179,10 @@ Functions partitioning the input list into a list of lists.
* [-partition-all-in-steps](#-partition-all-in-steps-n-step-list) `(n step list)`
* [-partition-by](#-partition-by-fn-list) `(fn list)`
* [-partition-by-header](#-partition-by-header-fn-list) `(fn list)`
* [-partition-after-pred](#-partition-after-pred-pred-list) `(pred list)`
* [-partition-before-pred](#-partition-before-pred-pred-list) `(pred list)`
* [-partition-before-item](#-partition-before-item-item-list) `(item list)`
* [-partition-after-item](#-partition-after-item-item-list) `(item list)`
* [-group-by](#-group-by-fn-list) `(fn list)`
### Indexing
@ -372,7 +376,7 @@ See also: [`-map-when`](#-map-when-pred-rep-list), [`-replace-last`](#-replace-l
Return a new list consisting of the result of (`fn` index item) for each item in `list`.
In the anaphoric form `--map-indexed`, the index is exposed as `it-index`.
In the anaphoric form `--map-indexed`, the index is exposed as symbol `it-index`.
See also: [`-each-indexed`](#-each-indexed-list-fn).
@ -655,7 +659,7 @@ See also: [`-select-columns`](#-select-columns-columns-table), [`-select-by-indi
## List to list
Bag of various functions which modify input list.
Functions returning a modified copy of the input list.
#### -keep `(fn list)`
@ -828,7 +832,7 @@ item, etc. If `list` contains no items, return `initial-value` and
`fn` is not called.
In the anaphoric form `--reduce-from`, the accumulated value is
exposed as `acc`.
exposed as symbol `acc`.
See also: [`-reduce`](#-reduce-fn-list), [`-reduce-r`](#-reduce-r-fn-list)
@ -864,7 +868,7 @@ reduce return the result of calling `fn` with no arguments. If
`list` has only 1 item, it is returned and `fn` is not called.
In the anaphoric form `--reduce`, the accumulated value is
exposed as `acc`.
exposed as symbol `acc`.
See also: [`-reduce-from`](#-reduce-from-fn-initial-value-list), [`-reduce-r`](#-reduce-r-fn-list)
@ -1025,7 +1029,7 @@ Alias: `-any-p`, `-some?`, `-some-p`
```el
(-any? 'even? '(1 2 3)) ;; => t
(-any? 'even? '(1 3 5)) ;; => nil
(--any? (= 0 (% it 2)) '(1 2 3)) ;; => t
(-any? 'null '(1 3 5)) ;; => nil
```
#### -all? `(pred list)`
@ -1269,6 +1273,46 @@ other value (the body).
(-partition-by-header 'even? '(2 1 1 1 4 1 3 5 6 6 1)) ;; => '((2 1 1 1) (4 1 3 5) (6 6 1))
```
#### -partition-after-pred `(pred list)`
Partition directly after each time `pred` is true on an element of `list`.
```el
(-partition-after-pred (function oddp) '()) ;; => '()
(-partition-after-pred (function oddp) '(1)) ;; => '((1))
(-partition-after-pred (function oddp) '(0 1)) ;; => '((0 1))
```
#### -partition-before-pred `(pred list)`
Partition directly before each time `pred` is true on an element of `list`.
```el
(-partition-before-pred (function oddp) '()) ;; => '()
(-partition-before-pred (function oddp) '(1)) ;; => '((1))
(-partition-before-pred (function oddp) '(0 1)) ;; => '((0) (1))
```
#### -partition-before-item `(item list)`
Partition directly before each time `item` appears in `list`.
```el
(-partition-before-item 3 '()) ;; => '()
(-partition-before-item 3 '(1)) ;; => '((1))
(-partition-before-item 3 '(3)) ;; => '((3))
```
#### -partition-after-item `(item list)`
Partition directly after each time `item` appears in `list`.
```el
(-partition-after-item 3 '()) ;; => '()
(-partition-after-item 3 '(1)) ;; => '((1))
(-partition-after-item 3 '(3)) ;; => '((3))
```
#### -group-by `(fn list)`
Separate `list` into an alist whose keys are `fn` applied to the
@ -1526,8 +1570,8 @@ function is applied pairwise taking as first argument element of
`list1` and as second argument element of `list2` at corresponding
position.
The anaphoric form `--zip-with` binds the elements from `list1` as `it`,
and the elements from `list2` as `other`.
The anaphoric form `--zip-with` binds the elements from `list1` as symbol `it`,
and the elements from `list2` as symbol `other`.
```el
(-zip-with '+ '(1 2 3) '(4 5 6)) ;; => '(5 7 9)
@ -1657,7 +1701,7 @@ Alias: `-find`
```el
(-first 'even? '(1 2 3)) ;; => 2
(-first 'even? '(1 3 5)) ;; => nil
(--first (> it 2) '(1 2 3)) ;; => 3
(-first 'null '(1 3 5)) ;; => nil
```
#### -some `(pred list)`
@ -1668,8 +1712,8 @@ Alias: `-any`
```el
(-some 'even? '(1 2 3)) ;; => t
(--some (member 'foo it) '((foo bar) (baz))) ;; => '(foo bar)
(--some (plist-get it :bar) '((:foo 1 :bar 2) (:baz 3))) ;; => 2
(-some 'null '(1 2 3)) ;; => nil
(-some 'null '(1 2 nil)) ;; => t
```
#### -last `(pred list)`
@ -1911,7 +1955,7 @@ last item in second form, etc.
Starting with the value of `x`, thread each expression through `forms`.
Insert `x` at the position signified by the token `it` in the first
Insert `x` at the position signified by the symbol `it` in the first
form. If there are more forms, insert the first form at the position
signified by `it` in in second form, etc.
@ -1976,10 +2020,11 @@ Convenient versions of `let` and `let*` constructs combined with flow control.
#### -when-let `(var-val &rest body)`
If `val` evaluates to non-nil, bind it to `var` and execute body.
`var-val` should be a (`var` `val`) pair.
Note: binding is done according to [`-let`](#-let-varlist-rest-body).
(fn (`var` `val`) &rest `body`)
```el
(-when-let (match-index (string-match "d" "abcd")) (+ match-index 2)) ;; => 5
(-when-let ((&plist :foo foo) (list :foo "foo")) foo) ;; => "foo"
@ -2004,10 +2049,12 @@ encountered.
#### -if-let `(var-val then &rest else)`
If `val` evaluates to non-nil, bind it to `var` and do `then`,
otherwise do `else`. `var-val` should be a (`var` `val`) pair.
otherwise do `else`.
Note: binding is done according to [`-let`](#-let-varlist-rest-body).
(fn (`var` `val`) `then` &rest `else`)
```el
(-if-let (match-index (string-match "d" "abc")) (+ match-index 3) 7) ;; => 7
(--if-let (even? 4) it nil) ;; => t
@ -2237,7 +2284,7 @@ Return nil, used for side-effects only.
Call (`fn` index item) for each item in `list`.
In the anaphoric form `--each-indexed`, the index is exposed as `it-index`.
In the anaphoric form `--each-indexed`, the index is exposed as symbol `it-index`.
See also: [`-map-indexed`](#-map-indexed-fn-list).

@ -1,4 +1,4 @@
This is dash.info, produced by makeinfo version 6.1 from dash.texi.
This is dash.info, produced by makeinfo version 6.5 from dash.texi.
This manual is for ‘dash.el’ version 2.12.1.
@ -253,7 +253,7 @@ The results are collected in order and returned as new list.
each item in LIST.
In the anaphoric form ‘--map-indexed’, the index is exposed as
‘it-index‘.
symbol ‘it-index’.
See also: ‘-each-indexed’ (*note -each-indexed::).
@ -726,7 +726,7 @@ Functions reducing lists into single value.
not called.
In the anaphoric form ‘--reduce-from’, the accumulated value is
exposed as ‘acc‘.
exposed as symbol ‘acc’.
See also: ‘-reduce’ (*note -reduce::), ‘-reduce-r’ (*note
-reduce-r::)
@ -765,7 +765,7 @@ Functions reducing lists into single value.
LIST has only 1 item, it is returned and FN is not called.
In the anaphoric form ‘--reduce’, the accumulated value is
exposed as ‘acc‘.
exposed as symbol ‘acc’.
See also: ‘-reduce-from’ (*note -reduce-from::), ‘-reduce-r’
(*note -reduce-r::)
@ -935,8 +935,8 @@ File: dash.info, Node: Predicates, Next: Partitioning, Prev: Unfolding, Up:
⇒ t
(-any? 'even? '(1 3 5))
⇒ nil
(--any? (= 0 (% it 2)) '(1 2 3))
t
(-any? 'null '(1 3 5))
nil
-- Function: -all? (pred list)
Return t if (PRED x) is non-nil for all x in LIST, else nil.
@ -1189,6 +1189,48 @@ Functions partitioning the input list into a list of lists.
(-partition-by-header 'even? '(2 1 1 1 4 1 3 5 6 6 1))
⇒ '((2 1 1 1) (4 1 3 5) (6 6 1))
-- Function: -partition-after-pred (pred list)
Partition directly after each time PRED is true on an element of
LIST.
(-partition-after-pred (function oddp) '())
⇒ '()
(-partition-after-pred (function oddp) '(1))
⇒ '((1))
(-partition-after-pred (function oddp) '(0 1))
⇒ '((0 1))
-- Function: -partition-before-pred (pred list)
Partition directly before each time PRED is true on an element of
LIST.
(-partition-before-pred (function oddp) '())
⇒ '()
(-partition-before-pred (function oddp) '(1))
⇒ '((1))
(-partition-before-pred (function oddp) '(0 1))
⇒ '((0) (1))
-- Function: -partition-before-item (item list)
Partition directly before each time ITEM appears in LIST.
(-partition-before-item 3 '())
⇒ '()
(-partition-before-item 3 '(1))
⇒ '((1))
(-partition-before-item 3 '(3))
⇒ '((3))
-- Function: -partition-after-item (item list)
Partition directly after each time ITEM appears in LIST.
(-partition-after-item 3 '())
⇒ '()
(-partition-after-item 3 '(1))
⇒ '((1))
(-partition-after-item 3 '(3))
⇒ '((3))
-- Function: -group-by (fn list)
Separate LIST into an alist whose keys are FN applied to the
elements of LIST. Keys are compared by ‘equal’.
@ -1449,7 +1491,7 @@ Other list functions not fit to be classified elsewhere.
position.
The anaphoric form ‘--zip-with’ binds the elements from LIST1 as
‘it‘, and the elements from LIST2 as ‘other‘.
symbol ‘it’, and the elements from LIST2 as symbol ‘other’.
(-zip-with '+ '(1 2 3) '(4 5 6))
⇒ '(5 7 9)
@ -1581,8 +1623,8 @@ Other list functions not fit to be classified elsewhere.
⇒ 2
(-first 'even? '(1 3 5))
⇒ nil
(--first (> it 2) '(1 2 3))
3
(-first 'null '(1 3 5))
nil
-- Function: -some (pred list)
Return (PRED x) for the first LIST item where (PRED x) is
@ -1592,10 +1634,10 @@ Other list functions not fit to be classified elsewhere.
(-some 'even? '(1 2 3))
⇒ t
(--some (member 'foo it) '((foo bar) (baz)))
'(foo bar)
(--some (plist-get it :bar) '((:foo 1 :bar 2) (:baz 3)))
2
(-some 'null '(1 2 3))
nil
(-some 'null '(1 2 nil))
t
-- Function: -last (pred list)
Return the last x in LIST where (PRED x) is non-nil, else nil.
@ -1842,9 +1884,9 @@ File: dash.info, Node: Threading macros, Next: Binding, Prev: Tree operations
Starting with the value of X, thread each expression through
FORMS.
Insert X at the position signified by the token ‘it’ in the first
form. If there are more forms, insert the first form at the
position signified by ‘it’ in in second form, etc.
Insert X at the position signified by the symbol ‘it’ in the
first form. If there are more forms, insert the first form at
the position signified by ‘it’ in in second form, etc.
(--> "def" (concat "abc" it "ghi"))
⇒ "abcdefghi"
@ -1913,10 +1955,11 @@ control.
-- Macro: -when-let (var-val &rest body)
If VAL evaluates to non-nil, bind it to VAR and execute body.
VAR-VAL should be a (VAR VAL) pair.
Note: binding is done according to ‘-let’ (*note -let::).
(fn (VAR VAL) &rest BODY)
(-when-let (match-index (string-match "d" "abcd")) (+ match-index 2))
⇒ 5
(-when-let ((&plist :foo foo) (list :foo "foo")) foo)
@ -1940,10 +1983,12 @@ control.
-- Macro: -if-let (var-val then &rest else)
If VAL evaluates to non-nil, bind it to VAR and do THEN,
otherwise do ELSE. VAR-VAL should be a (VAR VAL) pair.
otherwise do ELSE.
Note: binding is done according to ‘-let’ (*note -let::).
(fn (VAR VAL) THEN &rest ELSE)
(-if-let (match-index (string-match "d" "abc")) (+ match-index 3) 7)
⇒ 7
(--if-let (even? 4) it nil)
@ -2174,7 +2219,7 @@ Functions iterating over lists for side-effect only.
Call (FN index item) for each item in LIST.
In the anaphoric form ‘--each-indexed’, the index is exposed as
‘it-index‘.
symbol ‘it-index’.
See also: ‘-map-indexed’ (*note -map-indexed::).
@ -2713,9 +2758,9 @@ Index
(line 81)
* -grade-down: Indexing. (line 81)
* -grade-up: Indexing. (line 71)
* -group-by: Partitioning. (line 145)
* -if-let: Binding. (line 36)
* -if-let*: Binding. (line 47)
* -group-by: Partitioning. (line 187)
* -if-let: Binding. (line 37)
* -if-let*: Binding. (line 50)
* -insert-at: List to list. (line 109)
* -interleave: Other list operations.
(line 66)
@ -2731,13 +2776,13 @@ Index
* -juxt: Function combinators.
(line 31)
* -keep: List to list. (line 8)
* -lambda: Binding. (line 217)
* -lambda: Binding. (line 220)
* -last: Other list operations.
(line 232)
* -last-item: Other list operations.
(line 254)
* -let: Binding. (line 63)
* -let*: Binding. (line 197)
* -let: Binding. (line 66)
* -let*: Binding. (line 200)
* -list: Other list operations.
(line 287)
* -map: Maps. (line 10)
@ -2764,8 +2809,12 @@ Index
* -partial: Function combinators.
(line 9)
* -partition: Partitioning. (line 74)
* -partition-after-item: Partitioning. (line 177)
* -partition-after-pred: Partitioning. (line 145)
* -partition-all: Partitioning. (line 86)
* -partition-all-in-steps: Partitioning. (line 109)
* -partition-before-item: Partitioning. (line 167)
* -partition-before-pred: Partitioning. (line 156)
* -partition-by: Partitioning. (line 121)
* -partition-by-header: Partitioning. (line 132)
* -partition-in-steps: Partitioning. (line 97)
@ -2836,7 +2885,7 @@ Index
(line 122)
* -update-at: List to list. (line 133)
* -when-let: Binding. (line 9)
* -when-let*: Binding. (line 22)
* -when-let*: Binding. (line 23)
* -zip: Other list operations.
(line 93)
* -zip-fill: Other list operations.
@ -2858,173 +2907,177 @@ Ref: -map-when5595
Ref: -map-first6178
Ref: -map-last6656
Ref: -map-indexed7129
Ref: -annotate7602
Ref: -splice8092
Ref: -splice-list8873
Ref: -mapcat9335
Ref: -copy9711
Node: Sublist selection9915
Ref: -filter10108
Ref: -remove10526
Ref: -remove-first10888
Ref: -remove-last11415
Ref: -remove-item11936
Ref: -non-nil12330
Ref: -slice12489
Ref: -take13021
Ref: -take-last13329
Ref: -drop13652
Ref: -drop-last13925
Ref: -take-while14185
Ref: -drop-while14535
Ref: -select-by-indices14891
Ref: -select-columns15405
Ref: -select-column16110
Node: List to list16573
Ref: -keep16760
Ref: -concat17263
Ref: -flatten17560
Ref: -flatten-n18319
Ref: -replace18706
Ref: -replace-first19169
Ref: -replace-last19665
Ref: -insert-at20154
Ref: -replace-at20481
Ref: -update-at20876
Ref: -remove-at21367
Ref: -remove-at-indices21855
Node: Reductions22437
Ref: -reduce-from22606
Ref: -reduce-r-from23385
Ref: -reduce24170
Ref: -reduce-r24971
Ref: -count25887
Ref: -sum26111
Ref: -product26300
Ref: -min26509
Ref: -min-by26735
Ref: -max27258
Ref: -max-by27483
Node: Unfolding28011
Ref: -iterate28250
Ref: -unfold28695
Node: Predicates29503
Ref: -any?29627
Ref: -all?29955
Ref: -none?30285
Ref: -only-some?30587
Ref: -contains?31072
Ref: -same-items?31461
Ref: -is-prefix?31846
Ref: -is-suffix?32169
Ref: -is-infix?32492
Node: Partitioning32846
Ref: -split-at33034
Ref: -split-with33319
Ref: -split-on33722
Ref: -split-when34398
Ref: -separate35038
Ref: -partition35480
Ref: -partition-all35932
Ref: -partition-in-steps36360
Ref: -partition-all-in-steps36857
Ref: -partition-by37342
Ref: -partition-by-header37724
Ref: -group-by38328
Node: Indexing38765
Ref: -elem-index38967
Ref: -elem-indices39362
Ref: -find-index39745
Ref: -find-last-index40234
Ref: -find-indices40738
Ref: -grade-up41146
Ref: -grade-down41549
Node: Set operations41959
Ref: -union42142
Ref: -difference42584
Ref: -intersection43001
Ref: -powerset43438
Ref: -permutations43651
Ref: -distinct43951
Node: Other list operations44275
Ref: -rotate44500
Ref: -repeat44795
Ref: -cons*45058
Ref: -snoc45445
Ref: -interpose45858
Ref: -interleave46156
Ref: -zip-with46525
Ref: -zip47228
Ref: -zip-fill48034
Ref: -unzip48357
Ref: -cycle48891
Ref: -pad49264
Ref: -table49587
Ref: -table-flat50377
Ref: -first51386
Ref: -some51760
Ref: -last52130
Ref: -first-item52464
Ref: -last-item52777
Ref: -butlast53069
Ref: -sort53316
Ref: -list53804
Ref: -fix54135
Node: Tree operations54675
Ref: -tree-seq54871
Ref: -tree-map55729
Ref: -tree-map-nodes56172
Ref: -tree-reduce57027
Ref: -tree-reduce-from57909
Ref: -tree-mapreduce58510
Ref: -tree-mapreduce-from59370
Ref: -clone60656
Node: Threading macros60984
Ref: ->61129
Ref: ->>61621
Ref: -->62126
Ref: -as->62686
Ref: -some->63141
Ref: -some->>63515
Ref: -some-->63951
Node: Binding64422
Ref: -when-let64634
Ref: -when-let*65128
Ref: -if-let65656
Ref: -if-let*66051
Ref: -let66668
Ref: -let*71461
Ref: -lambda72402
Node: Side-effects73204
Ref: -each73398
Ref: -each-while73805
Ref: -each-indexed74165
Ref: -dotimes74676
Ref: -doto74979
Node: Destructive operations75406
Ref: !cons75579
Ref: !cdr75785
Node: Function combinators75980
Ref: -partial76254
Ref: -rpartial76649
Ref: -juxt77051
Ref: -compose77483
Ref: -applify78041
Ref: -on78488
Ref: -flip79011
Ref: -const79323
Ref: -cut79667
Ref: -not80153
Ref: -orfn80463
Ref: -andfn80897
Ref: -iteratefn81392
Ref: -fixfn82095
Ref: -prodfn83664
Node: Development84730
Node: Contribute85079
Node: Changes85827
Node: Contributors88826
Node: Index90450
Ref: -annotate7609
Ref: -splice8099
Ref: -splice-list8880
Ref: -mapcat9342
Ref: -copy9718
Node: Sublist selection9922
Ref: -filter10115
Ref: -remove10533
Ref: -remove-first10895
Ref: -remove-last11422
Ref: -remove-item11943
Ref: -non-nil12337
Ref: -slice12496
Ref: -take13028
Ref: -take-last13336
Ref: -drop13659
Ref: -drop-last13932
Ref: -take-while14192
Ref: -drop-while14542
Ref: -select-by-indices14898
Ref: -select-columns15412
Ref: -select-column16117
Node: List to list16580
Ref: -keep16772
Ref: -concat17275
Ref: -flatten17572
Ref: -flatten-n18331
Ref: -replace18718
Ref: -replace-first19181
Ref: -replace-last19677
Ref: -insert-at20166
Ref: -replace-at20493
Ref: -update-at20888
Ref: -remove-at21379
Ref: -remove-at-indices21867
Node: Reductions22449
Ref: -reduce-from22618
Ref: -reduce-r-from23404
Ref: -reduce24189
Ref: -reduce-r24997
Ref: -count25913
Ref: -sum26137
Ref: -product26326
Ref: -min26535
Ref: -min-by26761
Ref: -max27284
Ref: -max-by27509
Node: Unfolding28037
Ref: -iterate28276
Ref: -unfold28721
Node: Predicates29529
Ref: -any?29653
Ref: -all?29973
Ref: -none?30303
Ref: -only-some?30605
Ref: -contains?31090
Ref: -same-items?31479
Ref: -is-prefix?31864
Ref: -is-suffix?32187
Ref: -is-infix?32510
Node: Partitioning32864
Ref: -split-at33052
Ref: -split-with33337
Ref: -split-on33740
Ref: -split-when34416
Ref: -separate35056
Ref: -partition35498
Ref: -partition-all35950
Ref: -partition-in-steps36378
Ref: -partition-all-in-steps36875
Ref: -partition-by37360
Ref: -partition-by-header37742
Ref: -partition-after-pred38346
Ref: -partition-before-pred38717
Ref: -partition-before-item39095
Ref: -partition-after-item39406
Ref: -group-by39712
Node: Indexing40149
Ref: -elem-index40351
Ref: -elem-indices40746
Ref: -find-index41129
Ref: -find-last-index41618
Ref: -find-indices42122
Ref: -grade-up42530
Ref: -grade-down42933
Node: Set operations43343
Ref: -union43526
Ref: -difference43968
Ref: -intersection44385
Ref: -powerset44822
Ref: -permutations45035
Ref: -distinct45335
Node: Other list operations45659
Ref: -rotate45884
Ref: -repeat46179
Ref: -cons*46442
Ref: -snoc46829
Ref: -interpose47242
Ref: -interleave47540
Ref: -zip-with47909
Ref: -zip48626
Ref: -zip-fill49432
Ref: -unzip49755
Ref: -cycle50289
Ref: -pad50662
Ref: -table50985
Ref: -table-flat51775
Ref: -first52784
Ref: -some53156
Ref: -last53465
Ref: -first-item53799
Ref: -last-item54112
Ref: -butlast54404
Ref: -sort54651
Ref: -list55139
Ref: -fix55470
Node: Tree operations56010
Ref: -tree-seq56206
Ref: -tree-map57064
Ref: -tree-map-nodes57507
Ref: -tree-reduce58362
Ref: -tree-reduce-from59244
Ref: -tree-mapreduce59845
Ref: -tree-mapreduce-from60705
Ref: -clone61991
Node: Threading macros62319
Ref: ->62464
Ref: ->>62956
Ref: -->63461
Ref: -as->64022
Ref: -some->64477
Ref: -some->>64851
Ref: -some-->65287
Node: Binding65758
Ref: -when-let65970
Ref: -when-let*66455
Ref: -if-let66983
Ref: -if-let*67378
Ref: -let67995
Ref: -let*72788
Ref: -lambda73729
Node: Side-effects74531
Ref: -each74725
Ref: -each-while75132
Ref: -each-indexed75492
Ref: -dotimes76010
Ref: -doto76313
Node: Destructive operations76740
Ref: !cons76913
Ref: !cdr77119
Node: Function combinators77314
Ref: -partial77588
Ref: -rpartial77983
Ref: -juxt78385
Ref: -compose78817
Ref: -applify79375
Ref: -on79822
Ref: -flip80345
Ref: -const80657
Ref: -cut81001
Ref: -not81487
Ref: -orfn81797
Ref: -andfn82231
Ref: -iteratefn82726
Ref: -fixfn83429
Ref: -prodfn84998
Node: Development86064
Node: Contribute86413
Node: Changes87161
Node: Contributors90160
Node: Index91784

End Tag Table

@ -298,7 +298,7 @@ See also: @code{-map-when} (@pxref{-map-when}), @code{-replace-last} (@pxref{-re
@defun -map-indexed (fn list)
Return a new list consisting of the result of (@var{fn} index item) for each item in @var{list}.
In the anaphoric form @code{--map-indexed}, the index is exposed as `it-index`.
In the anaphoric form @code{--map-indexed}, the index is exposed as symbol @code{it-index}.
See also: @code{-each-indexed} (@pxref{-each-indexed}).
@ -1070,7 +1070,7 @@ item, etc. If @var{list} contains no items, return @var{initial-value} and
@var{fn} is not called.
In the anaphoric form @code{--reduce-from}, the accumulated value is
exposed as `acc`.
exposed as symbol @code{acc}.
See also: @code{-reduce} (@pxref{-reduce}), @code{-reduce-r} (@pxref{-reduce-r})
@ -1126,7 +1126,7 @@ reduce return the result of calling @var{fn} with no arguments. If
@var{list} has only 1 item, it is returned and @var{fn} is not called.
In the anaphoric form @code{--reduce}, the accumulated value is
exposed as `acc`.
exposed as symbol @code{acc}.
See also: @code{-reduce-from} (@pxref{-reduce-from}), @code{-reduce-r} (@pxref{-reduce-r})
@ -1404,8 +1404,8 @@ Alias: @code{-any-p}, @code{-some?}, @code{-some-p}
@result{} nil
@end group
@group
(--any? (= 0 (% it 2)) '(1 2 3))
@result{} t
(-any? 'null '(1 3 5))
@result{} nil
@end group
@end example
@end defun
@ -1840,6 +1840,86 @@ other value (the body).
@end example
@end defun
@anchor{-partition-after-pred}
@defun -partition-after-pred (pred list)
Partition directly after each time @var{pred} is true on an element of @var{list}.
@example
@group
(-partition-after-pred (function oddp) '())
@result{} '()
@end group
@group
(-partition-after-pred (function oddp) '(1))
@result{} '((1))
@end group
@group
(-partition-after-pred (function oddp) '(0 1))
@result{} '((0 1))
@end group
@end example
@end defun
@anchor{-partition-before-pred}
@defun -partition-before-pred (pred list)
Partition directly before each time @var{pred} is true on an element of @var{list}.
@example
@group
(-partition-before-pred (function oddp) '())
@result{} '()
@end group
@group
(-partition-before-pred (function oddp) '(1))
@result{} '((1))
@end group
@group
(-partition-before-pred (function oddp) '(0 1))
@result{} '((0) (1))
@end group
@end example
@end defun
@anchor{-partition-before-item}
@defun -partition-before-item (item list)
Partition directly before each time @var{item} appears in @var{list}.
@example
@group
(-partition-before-item 3 '())
@result{} '()
@end group
@group
(-partition-before-item 3 '(1))
@result{} '((1))
@end group
@group
(-partition-before-item 3 '(3))
@result{} '((3))
@end group
@end example
@end defun
@anchor{-partition-after-item}
@defun -partition-after-item (item list)
Partition directly after each time @var{item} appears in @var{list}.
@example
@group
(-partition-after-item 3 '())
@result{} '()
@end group
@group
(-partition-after-item 3 '(1))
@result{} '((1))
@end group
@group
(-partition-after-item 3 '(3))
@result{} '((3))
@end group
@end example
@end defun
@anchor{-group-by}
@defun -group-by (fn list)
Separate @var{list} into an alist whose keys are @var{fn} applied to the
@ -2288,8 +2368,8 @@ function is applied pairwise taking as first argument element of
@var{list1} and as second argument element of @var{list2} at corresponding
position.
The anaphoric form @code{--zip-with} binds the elements from @var{list1} as `it`,
and the elements from @var{list2} as `other`.
The anaphoric form @code{--zip-with} binds the elements from @var{list1} as symbol @code{it},
and the elements from @var{list2} as symbol @code{other}.
@example
@group
@ -2497,8 +2577,8 @@ Alias: @code{-find}
@result{} nil
@end group
@group
(--first (> it 2) '(1 2 3))
@result{} 3
(-first 'null '(1 3 5))
@result{} nil
@end group
@end example
@end defun
@ -2515,12 +2595,12 @@ Alias: @code{-any}
@result{} t
@end group
@group
(--some (member 'foo it) '((foo bar) (baz)))
@result{} '(foo bar)
(-some 'null '(1 2 3))
@result{} nil
@end group
@group
(--some (plist-get it :bar) '((:foo 1 :bar 2) (:baz 3)))
@result{} 2
(-some 'null '(1 2 nil))
@result{} t
@end group
@end example
@end defun
@ -2925,7 +3005,7 @@ last item in second form, etc.
@defmac --> (x &rest forms)
Starting with the value of @var{x}, thread each expression through @var{forms}.
Insert @var{x} at the position signified by the token @code{it} in the first
Insert @var{x} at the position signified by the symbol @code{it} in the first
form. If there are more forms, insert the first form at the position
signified by @code{it} in in second form, etc.
@ -3042,10 +3122,11 @@ Convenient versions of `let` and `let*` constructs combined with flow control.
@anchor{-when-let}
@defmac -when-let (var-val &rest body)
If @var{val} evaluates to non-nil, bind it to @var{var} and execute body.
@var{var-val} should be a (@var{var} @var{val}) pair.
Note: binding is done according to @code{-let} (@pxref{-let}).
(fn (@var{var} @var{val}) &rest @var{body})
@example
@group
(-when-let (match-index (string-match "d" "abcd")) (+ match-index 2))
@ -3087,10 +3168,12 @@ encountered.
@anchor{-if-let}
@defmac -if-let (var-val then &rest else)
If @var{val} evaluates to non-nil, bind it to @var{var} and do @var{then},
otherwise do @var{else}. @var{var-val} should be a (@var{var} @var{val}) pair.
otherwise do @var{else}.
Note: binding is done according to @code{-let} (@pxref{-let}).
(fn (@var{var} @var{val}) @var{then} &rest @var{else})
@example
@group
(-if-let (match-index (string-match "d" "abc")) (+ match-index 3) 7)
@ -3386,7 +3469,7 @@ Return nil, used for side-effects only.
@defun -each-indexed (list fn)
Call (@var{fn} index item) for each item in @var{list}.
In the anaphoric form @code{--each-indexed}, the index is exposed as `it-index`.
In the anaphoric form @code{--each-indexed}, the index is exposed as symbol @code{it-index}.
See also: @code{-map-indexed} (@pxref{-map-indexed}).

Loading…
Cancel
Save