diff options
author | Matus Goljer <goljer@logio.cz> | 2019-04-24 20:04:40 +0200 |
---|---|---|
committer | Matus Goljer <goljer@logio.cz> | 2019-04-24 20:04:40 +0200 |
commit | 258c324d9840901db83b2cabef3fa75bba57c1ba (patch) | |
tree | 082878dacff641102471131bd154342fe1cbbf17 | |
parent | 15498602f42c19c1b8d7f8768f6b998dfd5b3a22 (diff) |
Release 2.16.0
-rw-r--r-- | README.md | 49 | ||||
-rw-r--r-- | dash.el | 2 | ||||
-rw-r--r-- | dash.info | 441 | ||||
-rw-r--r-- | dash.texi | 53 | ||||
-rw-r--r-- | readme-template.md | 7 |
5 files changed, 324 insertions, 228 deletions
@@ -19,11 +19,11 @@ If you want the function combinators, then also: Add this to the big comment block at the top: - ;; Package-Requires: ((dash "2.15.0")) + ;; Package-Requires: ((dash "2.16.0")) To get function combinators: - ;; Package-Requires: ((dash "2.15.0") (dash-functional "1.2.0") (emacs "24")) + ;; Package-Requires: ((dash "2.16.0") (dash-functional "1.2.0") (emacs "24")) ## Upcoming breaking change! @@ -147,6 +147,7 @@ Functions reducing lists into single value. * [-inits](#-inits-list) `(list)` * [-tails](#-tails-list) `(list)` * [-common-prefix](#-common-prefix-rest-lists) `(&rest lists)` +* [-common-suffix](#-common-suffix-rest-lists) `(&rest lists)` * [-min](#-min-list) `(list)` * [-min-by](#-min-by-comparator-list) `(comparator list)` * [-max](#-max-list) `(list)` @@ -302,6 +303,7 @@ Functions iterating over lists for side-effect only. * [-each-r-while](#-each-r-while-list-pred-fn) `(list pred fn)` * [-dotimes](#-dotimes-num-fn) `(num fn)` * [-doto](#-doto-eval-initial-value-rest-forms) `(eval-initial-value &rest forms)` +* [--doto](#--doto-eval-initial-value-rest-forms) `(eval-initial-value &rest forms)` ### Destructive operations @@ -1052,10 +1054,20 @@ Return the longest common prefix of `lists`. ```el (-common-prefix '(1)) ;; => '(1) -(-common-prefix '(1 2) nil '(1 2)) ;; => nil +(-common-prefix '(1 2) '(3 4) '(1 2)) ;; => nil (-common-prefix '(1 2) '(1 2 3) '(1 2 3 4)) ;; => '(1 2) ``` +#### -common-suffix `(&rest lists)` + +Return the longest common suffix of `lists`. + +```el +(-common-suffix '(1)) ;; => '(1) +(-common-suffix '(1 2) '(3 4) '(1 2)) ;; => nil +(-common-suffix '(1 2 3 4) '(2 3 4) '(3 4)) ;; => '(3 4) +``` + #### -min `(list)` Return the smallest value from `list` of numbers or markers. @@ -1405,9 +1417,9 @@ other value (the body). Partition directly after each time `pred` is true on an element of `list`. ```el -(-partition-after-pred #'oddp '()) ;; => '() -(-partition-after-pred #'oddp '(1)) ;; => '((1)) -(-partition-after-pred #'oddp '(0 1)) ;; => '((0 1)) +(-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)` @@ -1415,9 +1427,9 @@ Partition directly after each time `pred` is true on an element of `list`. Partition directly before each time `pred` is true on an element of `list`. ```el -(-partition-before-pred #'oddp '()) ;; => '() -(-partition-before-pred #'oddp '(1)) ;; => '((1)) -(-partition-before-pred #'oddp '(0 1)) ;; => '((0) (1)) +(-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)` @@ -1629,6 +1641,7 @@ The time complexity is `o`(n). ```el (-rotate 3 '(1 2 3 4 5 6 7)) ;; => '(5 6 7 1 2 3 4) (-rotate -3 '(1 2 3 4 5 6 7)) ;; => '(4 5 6 7 1 2 3) +(-rotate 16 '(1 2 3 4 5 6 7)) ;; => '(6 7 1 2 3 4 5) ``` #### -repeat `(n x)` @@ -2574,6 +2587,15 @@ the target form. (-doto '(1 . 2) (setcar 3) (setcdr 4)) ;; => '(3 . 4) ``` +#### --doto `(eval-initial-value &rest forms)` + +Anaphoric form of [`-doto`](#-doto-eval-initial-value-rest-forms). +Note: `it` is not required in each form. + +```el +(gethash "key" (--doto (make-hash-table :test 'equal) (puthash "key" "value" it))) ;; => "value" +``` + ## Destructive operations @@ -2658,7 +2680,7 @@ expects a list with n items as arguments ```el (-map (-applify '+) '((1 1 1) (1 2 3) (5 5 5))) ;; => '(3 6 15) -(-map (-applify (lambda (a b c) `(,a (,b (,c))))) '((1 1 1) (1 2 3) (5 5 5))) ;; => '((1 (1 (1))) (1 (2 (3))) (5 (5 (5)))) +(-map (-applify (lambda (a b c) (\` ((\, a) ((\, b) ((\, c))))))) '((1 1 1) (1 2 3) (5 5 5))) ;; => '((1 (1 (1))) (1 (2 (3))) (5 (5 (5)))) (funcall (-applify '<) '(3 6)) ;; => t ``` @@ -2856,6 +2878,13 @@ Change `readme-template.md` or `examples-to-docs.el` instead. ## Changelist +### From 2.15 to 2.16 + +- Added `--doto`, anaphoric version of `-doto` (#282) +- Aliased `-cons-pair-p` to `-cons-pair?`(#288) +- Generalized `-rotate` for |n| greater than the length of the list (@leungbk, #290) +- Added a mechanism to extend destructuring with custom matchers (@yyoncho, #277) + ### From 2.14 to 2.15 This release brings new destructuring features, some new control flow @@ -3,7 +3,7 @@ ;; Copyright (C) 2012-2016 Free Software Foundation, Inc. ;; Author: Magnar Sveen <magnars@gmail.com> -;; Version: 2.15.0 +;; Version: 2.16.0 ;; Keywords: lists ;; This program is free software; you can redistribute it and/or modify @@ -942,11 +942,21 @@ Functions reducing lists into single value. (-common-prefix '(1)) ⇒ '(1) - (-common-prefix '(1 2) nil '(1 2)) + (-common-prefix '(1 2) '(3 4) '(1 2)) ⇒ nil (-common-prefix '(1 2) '(1 2 3) '(1 2 3 4)) ⇒ '(1 2) + -- Function: -common-suffix (&rest lists) + Return the longest common suffix of LISTS. + + (-common-suffix '(1)) + ⇒ '(1) + (-common-suffix '(1 2) '(3 4) '(1 2)) + ⇒ nil + (-common-suffix '(1 2 3 4) '(2 3 4) '(3 4)) + ⇒ '(3 4) + -- Function: -min (list) Return the smallest value from LIST of numbers or markers. @@ -1312,22 +1322,22 @@ Functions partitioning the input list into a list of lists. Partition directly after each time PRED is true on an element of LIST. - (-partition-after-pred #'oddp '()) + (-partition-after-pred (function oddp) '()) ⇒ '() - (-partition-after-pred #'oddp '(1)) + (-partition-after-pred (function oddp) '(1)) ⇒ '((1)) - (-partition-after-pred #'oddp '(0 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 #'oddp '()) + (-partition-before-pred (function oddp) '()) ⇒ '() - (-partition-before-pred #'oddp '(1)) + (-partition-before-pred (function oddp) '(1)) ⇒ '((1)) - (-partition-before-pred #'oddp '(0 1)) + (-partition-before-pred (function oddp) '(0 1)) ⇒ '((0) (1)) -- Function: -partition-before-item (item list) @@ -1542,6 +1552,8 @@ Other list functions not fit to be classified elsewhere. ⇒ '(5 6 7 1 2 3 4) (-rotate -3 '(1 2 3 4 5 6 7)) ⇒ '(4 5 6 7 1 2 3) + (-rotate 16 '(1 2 3 4 5 6 7)) + ⇒ '(6 7 1 2 3 4 5) -- Function: -repeat (n x) Return a list with X repeated N times. Return nil if N is less @@ -2494,6 +2506,13 @@ Functions iterating over lists for side-effect only. (-doto '(1 . 2) (setcar 3) (setcdr 4)) ⇒ '(3 . 4) + -- Macro: --doto (eval-initial-value &rest forms) + Anaphoric form of ‘-doto’ (*note -doto::). Note: ‘it’ is not + required in each form. + + (gethash "key" (--doto (make-hash-table :test 'equal) (puthash "key" "value" it))) + ⇒ "value" + File: dash.info, Node: Destructive operations, Next: Function combinators, Prev: Side-effects, Up: Functions @@ -2578,7 +2597,7 @@ offered in a separate package: ‘dash-functional‘. (-map (-applify '+) '((1 1 1) (1 2 3) (5 5 5))) ⇒ '(3 6 15) - (-map (-applify (lambda (a b c) `(,a (,b (,c))))) '((1 1 1) (1 2 3) (5 5 5))) + (-map (-applify (lambda (a b c) (\` ((\, a) ((\, b) ((\, c))))))) '((1 1 1) (1 2 3) (5 5 5))) ⇒ '((1 (1 (1))) (1 (2 (3))) (5 (5 (5)))) (funcall (-applify '<) '(3 6)) ⇒ t @@ -2947,6 +2966,7 @@ Index * !cons: Destructive operations. (line 6) * -->: Threading macros. (line 32) +* --doto: Side-effects. (line 81) * ->: Threading macros. (line 6) * ->>: Threading macros. (line 19) * -all?: Predicates. (line 18) @@ -2958,14 +2978,15 @@ Index (line 56) * -as->: Threading macros. (line 47) * -butlast: Other list operations. - (line 311) + (line 313) * -clone: Tree operations. (line 123) * -common-prefix: Reductions. (line 224) +* -common-suffix: Reductions. (line 234) * -compose: Function combinators. (line 42) * -concat: List to list. (line 22) * -cons*: Other list operations. - (line 28) + (line 30) * -const: Function combinators. (line 93) * -contains?: Predicates. (line 57) @@ -2974,7 +2995,7 @@ Index * -cut: Function combinators. (line 106) * -cycle: Other list operations. - (line 139) + (line 141) * -difference: Set operations. (line 20) * -distinct: Set operations. (line 62) * -dotimes: Side-effects. (line 61) @@ -2990,17 +3011,17 @@ Index * -elem-index: Indexing. (line 9) * -elem-indices: Indexing. (line 21) * -fifth-item: Other list operations. - (line 291) + (line 293) * -filter: Sublist selection. (line 8) * -find-index: Indexing. (line 32) * -find-indices: Indexing. (line 60) * -find-last-index: Indexing. (line 46) * -first: Other list operations. - (line 205) + (line 207) * -first-item: Other list operations. - (line 242) + (line 244) * -fix: Other list operations. - (line 347) + (line 349) * -fixfn: Function combinators. (line 177) * -flatten: List to list. (line 33) @@ -3008,7 +3029,7 @@ Index * -flip: Function combinators. (line 81) * -fourth-item: Other list operations. - (line 281) + (line 283) * -grade-down: Indexing. (line 81) * -grade-up: Indexing. (line 71) * -group-by: Partitioning. (line 187) @@ -3017,9 +3038,9 @@ Index * -inits: Reductions. (line 204) * -insert-at: List to list. (line 109) * -interleave: Other list operations. - (line 66) + (line 68) * -interpose: Other list operations. - (line 56) + (line 58) * -intersection: Set operations. (line 32) * -is-infix?: Predicates. (line 110) * -is-prefix?: Predicates. (line 86) @@ -3032,23 +3053,23 @@ Index * -keep: List to list. (line 8) * -lambda: Binding. (line 253) * -last: Other list operations. - (line 232) + (line 234) * -last-item: Other list operations. - (line 301) + (line 303) * -let: Binding. (line 66) * -let*: Binding. (line 233) * -list: Other list operations. - (line 334) + (line 336) * -map: Maps. (line 10) * -map-first: Maps. (line 38) * -map-indexed: Maps. (line 66) * -map-last: Maps. (line 52) * -map-when: Maps. (line 21) * -mapcat: Maps. (line 124) -* -max: Reductions. (line 258) -* -max-by: Reductions. (line 268) -* -min: Reductions. (line 234) -* -min-by: Reductions. (line 244) +* -max: Reductions. (line 268) +* -max-by: Reductions. (line 278) +* -min: Reductions. (line 244) +* -min-by: Reductions. (line 254) * -non-nil: Sublist selection. (line 80) * -none?: Predicates. (line 30) * -not: Function combinators. @@ -3059,7 +3080,7 @@ Index * -orfn: Function combinators. (line 128) * -pad: Other list operations. - (line 150) + (line 152) * -partial: Function combinators. (line 9) * -partition: Partitioning. (line 74) @@ -3092,7 +3113,7 @@ Index * -remove-item: Sublist selection. (line 68) * -remove-last: Sublist selection. (line 53) * -repeat: Other list operations. - (line 17) + (line 19) * -replace: List to list. (line 67) * -replace-at: List to list. (line 120) * -replace-first: List to list. (line 81) @@ -3105,7 +3126,7 @@ Index * -running-sum: Reductions. (line 170) * -same-items?: Predicates. (line 72) * -second-item: Other list operations. - (line 257) + (line 259) * -select-by-indices: Sublist selection. (line 169) * -select-column: Sublist selection. (line 199) * -select-columns: Sublist selection. (line 180) @@ -3113,14 +3134,14 @@ Index * -setq: Binding. (line 276) * -slice: Sublist selection. (line 86) * -snoc: Other list operations. - (line 42) + (line 44) * -some: Other list operations. - (line 219) + (line 221) * -some-->: Threading macros. (line 84) * -some->: Threading macros. (line 60) * -some->>: Threading macros. (line 72) * -sort: Other list operations. - (line 321) + (line 323) * -splice: Maps. (line 91) * -splice-list: Maps. (line 111) * -split-at: Partitioning. (line 8) @@ -3129,15 +3150,15 @@ Index * -split-with: Partitioning. (line 17) * -sum: Reductions. (line 160) * -table: Other list operations. - (line 161) + (line 163) * -table-flat: Other list operations. - (line 180) + (line 182) * -tails: Reductions. (line 214) * -take: Sublist selection. (line 102) * -take-last: Sublist selection. (line 113) * -take-while: Sublist selection. (line 147) * -third-item: Other list operations. - (line 269) + (line 271) * -tree-map: Tree operations. (line 28) * -tree-map-nodes: Tree operations. (line 39) * -tree-mapreduce: Tree operations. (line 85) @@ -3148,16 +3169,16 @@ Index * -unfold: Unfolding. (line 25) * -union: Set operations. (line 8) * -unzip: Other list operations. - (line 122) + (line 124) * -update-at: List to list. (line 133) * -when-let: Binding. (line 9) * -when-let*: Binding. (line 23) * -zip: Other list operations. - (line 93) + (line 95) * -zip-fill: Other list operations. - (line 114) + (line 116) * -zip-with: Other list operations. - (line 77) + (line 79) @@ -3189,177 +3210,179 @@ Ref: -slice12579 Ref: -take13111 Ref: -take-last13419 Ref: -drop13742 -Ref: -drop-last14016 -Ref: -take-while14277 -Ref: -drop-while14628 -Ref: -select-by-indices14984 -Ref: -select-columns15498 -Ref: -select-column16203 -Node: List to list16666 -Ref: -keep16858 -Ref: -concat17361 -Ref: -flatten17658 -Ref: -flatten-n18417 -Ref: -replace18804 -Ref: -replace-first19267 -Ref: -replace-last19763 -Ref: -insert-at20252 -Ref: -replace-at20579 -Ref: -update-at20974 -Ref: -remove-at21465 -Ref: -remove-at-indices21953 -Node: Reductions22535 -Ref: -reduce-from22704 -Ref: -reduce-r-from23470 -Ref: -reduce24237 -Ref: -reduce-r24971 -Ref: -reductions-from25841 -Ref: -reductions-r-from26556 -Ref: -reductions27281 -Ref: -reductions-r27906 -Ref: -count28541 -Ref: -sum28765 -Ref: -running-sum28955 -Ref: -product29249 -Ref: -running-product29459 -Ref: -inits29773 -Ref: -tails30021 -Ref: -common-prefix30268 -Ref: -min30562 -Ref: -min-by30788 -Ref: -max31311 -Ref: -max-by31536 -Node: Unfolding32064 -Ref: -iterate32303 -Ref: -unfold32748 -Node: Predicates33556 -Ref: -any?33680 -Ref: -all?34000 -Ref: -none?34330 -Ref: -only-some?34632 -Ref: -contains?35117 -Ref: -same-items?35506 -Ref: -is-prefix?35891 -Ref: -is-suffix?36214 -Ref: -is-infix?36537 -Node: Partitioning36891 -Ref: -split-at37079 -Ref: -split-with37364 -Ref: -split-on37767 -Ref: -split-when38443 -Ref: -separate39083 -Ref: -partition39525 -Ref: -partition-all39977 -Ref: -partition-in-steps40405 -Ref: -partition-all-in-steps40902 -Ref: -partition-by41387 -Ref: -partition-by-header41771 -Ref: -partition-after-pred42375 -Ref: -partition-before-pred42721 -Ref: -partition-before-item43074 -Ref: -partition-after-item43387 -Ref: -group-by43695 -Node: Indexing44134 -Ref: -elem-index44336 -Ref: -elem-indices44731 -Ref: -find-index45114 -Ref: -find-last-index45603 -Ref: -find-indices46107 -Ref: -grade-up46515 -Ref: -grade-down46918 -Node: Set operations47328 -Ref: -union47511 -Ref: -difference47954 -Ref: -intersection48374 -Ref: -powerset48815 -Ref: -permutations49029 -Ref: -distinct49330 -Node: Other list operations49656 -Ref: -rotate49881 -Ref: -repeat50176 -Ref: -cons*50439 -Ref: -snoc50826 -Ref: -interpose51239 -Ref: -interleave51539 -Ref: -zip-with51908 -Ref: -zip52625 -Ref: -zip-fill53431 -Ref: -unzip53754 -Ref: -cycle54288 -Ref: -pad54661 -Ref: -table54985 -Ref: -table-flat55775 -Ref: -first56784 -Ref: -some57156 -Ref: -last57465 -Ref: -first-item57799 -Ref: -second-item58215 -Ref: -third-item58495 -Ref: -fourth-item58773 -Ref: -fifth-item59039 -Ref: -last-item59301 -Ref: -butlast59593 -Ref: -sort59840 -Ref: -list60328 -Ref: -fix60659 -Node: Tree operations61199 -Ref: -tree-seq61395 -Ref: -tree-map62253 -Ref: -tree-map-nodes62696 -Ref: -tree-reduce63551 -Ref: -tree-reduce-from64433 -Ref: -tree-mapreduce65034 -Ref: -tree-mapreduce-from65894 -Ref: -clone67180 -Node: Threading macros67508 -Ref: ->67653 -Ref: ->>68145 -Ref: -->68650 -Ref: -as->69211 -Ref: -some->69666 -Ref: -some->>70040 -Ref: -some-->70476 -Node: Binding70947 -Ref: -when-let71159 -Ref: -when-let*71644 -Ref: -if-let72172 -Ref: -if-let*72567 -Ref: -let73184 -Ref: -let*79272 -Ref: -lambda80213 -Ref: -setq81015 -Node: Side-effects81831 -Ref: -each82025 -Ref: -each-while82432 -Ref: -each-indexed82792 -Ref: -each-r83310 -Ref: -each-r-while83743 -Ref: -dotimes84118 -Ref: -doto84421 -Node: Destructive operations84848 -Ref: !cons85021 -Ref: !cdr85227 -Node: Function combinators85423 -Ref: -partial85697 -Ref: -rpartial86092 -Ref: -juxt86494 -Ref: -compose86926 -Ref: -applify87484 -Ref: -on87915 -Ref: -flip88441 -Ref: -const88753 -Ref: -cut89097 -Ref: -not89583 -Ref: -orfn89893 -Ref: -andfn90327 -Ref: -iteratefn90822 -Ref: -fixfn91525 -Ref: -prodfn93094 -Node: Development94163 -Node: Contribute94512 -Node: Changes95260 -Node: Contributors98259 -Node: Index99883 +Ref: -drop-last14015 +Ref: -take-while14275 +Ref: -drop-while14625 +Ref: -select-by-indices14981 +Ref: -select-columns15495 +Ref: -select-column16200 +Node: List to list16663 +Ref: -keep16855 +Ref: -concat17358 +Ref: -flatten17655 +Ref: -flatten-n18414 +Ref: -replace18801 +Ref: -replace-first19264 +Ref: -replace-last19760 +Ref: -insert-at20249 +Ref: -replace-at20576 +Ref: -update-at20971 +Ref: -remove-at21462 +Ref: -remove-at-indices21950 +Node: Reductions22532 +Ref: -reduce-from22701 +Ref: -reduce-r-from23467 +Ref: -reduce24234 +Ref: -reduce-r24968 +Ref: -reductions-from25838 +Ref: -reductions-r-from26553 +Ref: -reductions27278 +Ref: -reductions-r27903 +Ref: -count28538 +Ref: -sum28762 +Ref: -running-sum28951 +Ref: -product29244 +Ref: -running-product29453 +Ref: -inits29766 +Ref: -tails30014 +Ref: -common-prefix30261 +Ref: -common-suffix30558 +Ref: -min30855 +Ref: -min-by31081 +Ref: -max31604 +Ref: -max-by31829 +Node: Unfolding32357 +Ref: -iterate32596 +Ref: -unfold33041 +Node: Predicates33849 +Ref: -any?33973 +Ref: -all?34293 +Ref: -none?34623 +Ref: -only-some?34925 +Ref: -contains?35410 +Ref: -same-items?35799 +Ref: -is-prefix?36184 +Ref: -is-suffix?36507 +Ref: -is-infix?36830 +Node: Partitioning37184 +Ref: -split-at37372 +Ref: -split-with37657 +Ref: -split-on38060 +Ref: -split-when38736 +Ref: -separate39376 +Ref: -partition39818 +Ref: -partition-all40270 +Ref: -partition-in-steps40698 +Ref: -partition-all-in-steps41195 +Ref: -partition-by41680 +Ref: -partition-by-header42062 +Ref: -partition-after-pred42666 +Ref: -partition-before-pred43037 +Ref: -partition-before-item43415 +Ref: -partition-after-item43726 +Ref: -group-by44032 +Node: Indexing44469 +Ref: -elem-index44671 +Ref: -elem-indices45066 +Ref: -find-index45449 +Ref: -find-last-index45938 +Ref: -find-indices46442 +Ref: -grade-up46850 +Ref: -grade-down47253 +Node: Set operations47663 +Ref: -union47846 +Ref: -difference48288 +Ref: -intersection48705 +Ref: -powerset49142 +Ref: -permutations49355 +Ref: -distinct49655 +Node: Other list operations49979 +Ref: -rotate50204 +Ref: -repeat50574 +Ref: -cons*50837 +Ref: -snoc51224 +Ref: -interpose51637 +Ref: -interleave51935 +Ref: -zip-with52304 +Ref: -zip53021 +Ref: -zip-fill53827 +Ref: -unzip54150 +Ref: -cycle54684 +Ref: -pad55057 +Ref: -table55380 +Ref: -table-flat56170 +Ref: -first57179 +Ref: -some57551 +Ref: -last57860 +Ref: -first-item58194 +Ref: -second-item58610 +Ref: -third-item58890 +Ref: -fourth-item59168 +Ref: -fifth-item59434 +Ref: -last-item59696 +Ref: -butlast59988 +Ref: -sort60235 +Ref: -list60723 +Ref: -fix61054 +Node: Tree operations61594 +Ref: -tree-seq61790 +Ref: -tree-map62648 +Ref: -tree-map-nodes63091 +Ref: -tree-reduce63946 +Ref: -tree-reduce-from64828 +Ref: -tree-mapreduce65429 +Ref: -tree-mapreduce-from66289 +Ref: -clone67575 +Node: Threading macros67903 +Ref: ->68048 +Ref: ->>68540 +Ref: -->69045 +Ref: -as->69606 +Ref: -some->70061 +Ref: -some->>70435 +Ref: -some-->70871 +Node: Binding71342 +Ref: -when-let71554 +Ref: -when-let*72039 +Ref: -if-let72567 +Ref: -if-let*72962 +Ref: -let73579 +Ref: -let*79667 +Ref: -lambda80608 +Ref: -setq81410 +Node: Side-effects82226 +Ref: -each82420 +Ref: -each-while82827 +Ref: -each-indexed83187 +Ref: -each-r83705 +Ref: -each-r-while84138 +Ref: -dotimes84513 +Ref: -doto84816 +Ref: --doto85243 +Node: Destructive operations85518 +Ref: !cons85691 +Ref: !cdr85897 +Node: Function combinators86092 +Ref: -partial86366 +Ref: -rpartial86761 +Ref: -juxt87163 +Ref: -compose87595 +Ref: -applify88153 +Ref: -on88600 +Ref: -flip89126 +Ref: -const89438 +Ref: -cut89782 +Ref: -not90268 +Ref: -orfn90578 +Ref: -andfn91012 +Ref: -iteratefn91507 +Ref: -fixfn92210 +Ref: -prodfn93779 +Node: Development94848 +Node: Contribute95197 +Node: Changes95945 +Node: Contributors98944 +Node: Index100568 End Tag Table @@ -1425,7 +1425,7 @@ Return the longest common prefix of @var{lists}. @result{} '(1) @end group @group -(-common-prefix '(1 2) nil '(1 2)) +(-common-prefix '(1 2) '(3 4) '(1 2)) @result{} nil @end group @group @@ -1435,6 +1435,26 @@ Return the longest common prefix of @var{lists}. @end example @end defun +@anchor{-common-suffix} +@defun -common-suffix (&rest lists) +Return the longest common suffix of @var{lists}. + +@example +@group +(-common-suffix '(1)) + @result{} '(1) +@end group +@group +(-common-suffix '(1 2) '(3 4) '(1 2)) + @result{} nil +@end group +@group +(-common-suffix '(1 2 3 4) '(2 3 4) '(3 4)) + @result{} '(3 4) +@end group +@end example +@end defun + @anchor{-min} @defun -min (list) Return the smallest value from @var{list} of numbers or markers. @@ -2047,15 +2067,15 @@ Partition directly after each time @var{pred} is true on an element of @var{list @example @group -(-partition-after-pred #'oddp '()) +(-partition-after-pred (function oddp) '()) @result{} '() @end group @group -(-partition-after-pred #'oddp '(1)) +(-partition-after-pred (function oddp) '(1)) @result{} '((1)) @end group @group -(-partition-after-pred #'oddp '(0 1)) +(-partition-after-pred (function oddp) '(0 1)) @result{} '((0 1)) @end group @end example @@ -2067,15 +2087,15 @@ Partition directly before each time @var{pred} is true on an element of @var{lis @example @group -(-partition-before-pred #'oddp '()) +(-partition-before-pred (function oddp) '()) @result{} '() @end group @group -(-partition-before-pred #'oddp '(1)) +(-partition-before-pred (function oddp) '(1)) @result{} '((1)) @end group @group -(-partition-before-pred #'oddp '(0 1)) +(-partition-before-pred (function oddp) '(0 1)) @result{} '((0) (1)) @end group @end example @@ -2450,6 +2470,10 @@ The time complexity is @var{o}(n). (-rotate -3 '(1 2 3 4 5 6 7)) @result{} '(4 5 6 7 1 2 3) @end group +@group +(-rotate 16 '(1 2 3 4 5 6 7)) + @result{} '(6 7 1 2 3 4 5) +@end group @end example @end defun @@ -3909,6 +3933,19 @@ the target form. @end example @end defmac +@anchor{--doto} +@defmac --doto (eval-initial-value &rest forms) +Anaphoric form of @code{-doto} (@pxref{-doto}). +Note: @code{it} is not required in each form. + +@example +@group +(gethash "key" (--doto (make-hash-table :test 'equal) (puthash "key" "value" it))) + @result{} "value" +@end group +@end example +@end defmac + @node Destructive operations @section Destructive operations @@ -4045,7 +4082,7 @@ expects a list with n items as arguments @result{} '(3 6 15) @end group @group -(-map (-applify (lambda (a b c) `(,a (,b (,c))))) '((1 1 1) (1 2 3) (5 5 5))) +(-map (-applify (lambda (a b c) (\` ((\, a) ((\, b) ((\, c))))))) '((1 1 1) (1 2 3) (5 5 5))) @result{} '((1 (1 (1))) (1 (2 (3))) (5 (5 (5)))) @end group @group diff --git a/readme-template.md b/readme-template.md index 1996179..cb2d876 100644 --- a/readme-template.md +++ b/readme-template.md @@ -98,6 +98,13 @@ Change `readme-template.md` or `examples-to-docs.el` instead. ## Changelist +### From 2.15 to 2.16 + +- Added `--doto`, anaphoric version of `-doto` (#282) +- Aliased `-cons-pair-p` to `-cons-pair?`(#288) +- Generalized `-rotate` for |n| greater than the length of the list (@leungbk, #290) +- Added a mechanism to extend destructuring with custom matchers (@yyoncho, #277) + ### From 2.14 to 2.15 This release brings new destructuring features, some new control flow |