dash.info (193918B)
1 This is dash.info, produced by makeinfo version 6.5 from dash.texi. 2 3 This manual is for Dash version 2.19.1. 4 5 Copyright © 2012–2021 Free Software Foundation, Inc. 6 7 Permission is granted to copy, distribute and/or modify this 8 document under the terms of the GNU Free Documentation License, 9 Version 1.3 or any later version published by the Free Software 10 Foundation; with the Invariant Sections being “GNU General Public 11 License,” and no Front-Cover Texts or Back-Cover Texts. A copy of 12 the license is included in the section entitled “GNU Free 13 Documentation License”. 14 INFO-DIR-SECTION Emacs 15 START-INFO-DIR-ENTRY 16 * Dash: (dash.info). A modern list library for GNU Emacs. 17 END-INFO-DIR-ENTRY 18 19 20 File: dash.info, Node: Top, Next: Installation, Up: (dir) 21 22 Dash 23 **** 24 25 This manual is for Dash version 2.19.1. 26 27 Copyright © 2012–2021 Free Software Foundation, Inc. 28 29 Permission is granted to copy, distribute and/or modify this 30 document under the terms of the GNU Free Documentation License, 31 Version 1.3 or any later version published by the Free Software 32 Foundation; with the Invariant Sections being “GNU General Public 33 License,” and no Front-Cover Texts or Back-Cover Texts. A copy of 34 the license is included in the section entitled “GNU Free 35 Documentation License”. 36 37 * Menu: 38 39 * Installation:: Installing and configuring Dash. 40 * Functions:: Dash API reference. 41 * Development:: Contributing to Dash development. 42 43 Appendices 44 45 * FDL:: The license for this documentation. 46 * GPL:: Conditions for copying and changing Dash. 47 * Index:: Index including functions and macros. 48 49 — The Detailed Node Listing — 50 51 Installation 52 53 * Using in a package:: Listing Dash as a package dependency. 54 * Fontification of special variables:: Font Lock of anaphoric macro variables. 55 * Info symbol lookup:: Looking up Dash symbols in this manual. 56 57 Functions 58 59 * Maps:: 60 * Sublist selection:: 61 * List to list:: 62 * Reductions:: 63 * Unfolding:: 64 * Predicates:: 65 * Partitioning:: 66 * Indexing:: 67 * Set operations:: 68 * Other list operations:: 69 * Tree operations:: 70 * Threading macros:: 71 * Binding:: 72 * Side effects:: 73 * Destructive operations:: 74 * Function combinators:: 75 76 Development 77 78 * Contribute:: How to contribute. 79 * Contributors:: List of contributors. 80 81 82 File: dash.info, Node: Installation, Next: Functions, Prev: Top, Up: Top 83 84 1 Installation 85 ************** 86 87 Dash is available on GNU ELPA (https://elpa.gnu.org/), GNU-devel ELPA 88 (https://elpa.gnu.org/devel/), and MELPA (https://melpa.org/), and can 89 be installed with the standard command ‘package-install’ (*note 90 (emacs)Package Installation::). 91 92 ‘M-x package-install <RET> dash <RET>’ 93 Install the Dash library. 94 95 Alternatively, you can just dump ‘dash.el’ in your ‘load-path’ 96 somewhere (*note (emacs)Lisp Libraries::). 97 98 * Menu: 99 100 * Using in a package:: Listing Dash as a package dependency. 101 * Fontification of special variables:: Font Lock of anaphoric macro variables. 102 * Info symbol lookup:: Looking up Dash symbols in this manual. 103 104 105 File: dash.info, Node: Using in a package, Next: Fontification of special variables, Up: Installation 106 107 1.1 Using in a package 108 ====================== 109 110 If you use Dash in your own package, be sure to list it as a dependency 111 in the library’s headers as follows (*note (elisp)Library Headers::). 112 113 ;; Package-Requires: ((dash "2.19.1")) 114 115 116 File: dash.info, Node: Fontification of special variables, Next: Info symbol lookup, Prev: Using in a package, Up: Installation 117 118 1.2 Fontification of special variables 119 ====================================== 120 121 The autoloaded minor mode ‘dash-fontify-mode’ is provided for optional 122 fontification of anaphoric Dash variables (‘it’, ‘acc’, etc.) in Emacs 123 Lisp buffers using search-based Font Lock (*note (emacs)Font Lock::). 124 In older Emacs versions which do not dynamically detect macros, the 125 minor mode also fontifies calls to Dash macros. 126 127 To automatically enable the minor mode in all Emacs Lisp buffers, 128 just call its autoloaded global counterpart ‘global-dash-fontify-mode’, 129 either interactively or from your ‘user-init-file’: 130 131 (global-dash-fontify-mode) 132 133 134 File: dash.info, Node: Info symbol lookup, Prev: Fontification of special variables, Up: Installation 135 136 1.3 Info symbol lookup 137 ====================== 138 139 While editing Elisp files, you can use ‘C-h S’ (‘info-lookup-symbol’) to 140 look up Elisp symbols in the relevant Info manuals (*note (emacs)Info 141 Lookup::). To enable the same for Dash symbols, use the command 142 ‘dash-register-info-lookup’. It can be called directly when needed, or 143 automatically from your ‘user-init-file’. For example: 144 145 (with-eval-after-load 'info-look 146 (dash-register-info-lookup)) 147 148 149 File: dash.info, Node: Functions, Next: Development, Prev: Installation, Up: Top 150 151 2 Functions 152 *********** 153 154 This chapter contains reference documentation for the Dash API 155 (Application Programming Interface). The names of all public functions 156 defined in the library are prefixed with a dash character (‘-’). 157 158 The library also provides anaphoric macro versions of functions where 159 that makes sense. The names of these macros are prefixed with two 160 dashes (‘--’) instead of one. 161 162 For instance, while the function ‘-map’ applies a function to each 163 element of a list, its anaphoric counterpart ‘--map’ evaluates a form 164 with the local variable ‘it’ temporarily bound to the current list 165 element instead. 166 167 ;; Normal version. 168 (-map (lambda (n) (* n n)) '(1 2 3 4)) 169 ⇒ (1 4 9 16) 170 171 ;; Anaphoric version. 172 (--map (* it it) '(1 2 3 4)) 173 ⇒ (1 4 9 16) 174 175 The normal version can, of course, also be written as in the 176 following example, which demonstrates the utility of both versions. 177 178 (defun my-square (n) 179 "Return N multiplied by itself." 180 (* n n)) 181 182 (-map #'my-square '(1 2 3 4)) 183 ⇒ (1 4 9 16) 184 185 * Menu: 186 187 * Maps:: 188 * Sublist selection:: 189 * List to list:: 190 * Reductions:: 191 * Unfolding:: 192 * Predicates:: 193 * Partitioning:: 194 * Indexing:: 195 * Set operations:: 196 * Other list operations:: 197 * Tree operations:: 198 * Threading macros:: 199 * Binding:: 200 * Side effects:: 201 * Destructive operations:: 202 * Function combinators:: 203 204 205 File: dash.info, Node: Maps, Next: Sublist selection, Up: Functions 206 207 2.1 Maps 208 ======== 209 210 Functions in this category take a transforming function, which is then 211 applied sequentially to each or selected elements of the input list. 212 The results are collected in order and returned as a new list. 213 214 -- Function: -map (fn list) 215 Apply FN to each item in LIST and return the list of results. 216 217 This function’s anaphoric counterpart is ‘--map’. 218 219 (-map (lambda (num) (* num num)) '(1 2 3 4)) 220 ⇒ (1 4 9 16) 221 (-map #'1+ '(1 2 3 4)) 222 ⇒ (2 3 4 5) 223 (--map (* it it) '(1 2 3 4)) 224 ⇒ (1 4 9 16) 225 226 -- Function: -map-when (pred rep list) 227 Return a new list where the elements in LIST that do not match the 228 PRED function are unchanged, and where the elements in LIST that do 229 match the PRED function are mapped through the REP function. 230 231 Alias: ‘-replace-where’ 232 233 See also: ‘-update-at’ (*note -update-at::) 234 235 (-map-when 'even? 'square '(1 2 3 4)) 236 ⇒ (1 4 3 16) 237 (--map-when (> it 2) (* it it) '(1 2 3 4)) 238 ⇒ (1 2 9 16) 239 (--map-when (= it 2) 17 '(1 2 3 4)) 240 ⇒ (1 17 3 4) 241 242 -- Function: -map-first (pred rep list) 243 Replace first item in LIST satisfying PRED with result of REP 244 called on this item. 245 246 See also: ‘-map-when’ (*note -map-when::), ‘-replace-first’ (*note 247 -replace-first::) 248 249 (-map-first 'even? 'square '(1 2 3 4)) 250 ⇒ (1 4 3 4) 251 (--map-first (> it 2) (* it it) '(1 2 3 4)) 252 ⇒ (1 2 9 4) 253 (--map-first (= it 2) 17 '(1 2 3 2)) 254 ⇒ (1 17 3 2) 255 256 -- Function: -map-last (pred rep list) 257 Replace last item in LIST satisfying PRED with result of REP called 258 on this item. 259 260 See also: ‘-map-when’ (*note -map-when::), ‘-replace-last’ (*note 261 -replace-last::) 262 263 (-map-last 'even? 'square '(1 2 3 4)) 264 ⇒ (1 2 3 16) 265 (--map-last (> it 2) (* it it) '(1 2 3 4)) 266 ⇒ (1 2 3 16) 267 (--map-last (= it 2) 17 '(1 2 3 2)) 268 ⇒ (1 2 3 17) 269 270 -- Function: -map-indexed (fn list) 271 Apply FN to each index and item in LIST and return the list of 272 results. This is like ‘-map’ (*note -map::), but FN takes two 273 arguments: the index of the current element within LIST, and the 274 element itself. 275 276 This function’s anaphoric counterpart is ‘--map-indexed’. 277 278 For a side-effecting variant, see also ‘-each-indexed’ (*note 279 -each-indexed::). 280 281 (-map-indexed (lambda (index item) (- item index)) '(1 2 3 4)) 282 ⇒ (1 1 1 1) 283 (--map-indexed (- it it-index) '(1 2 3 4)) 284 ⇒ (1 1 1 1) 285 (-map-indexed #'* '(1 2 3 4)) 286 ⇒ (0 2 6 12) 287 288 -- Function: -annotate (fn list) 289 Return a list of cons cells where each cell is FN applied to each 290 element of LIST paired with the unmodified element of LIST. 291 292 (-annotate '1+ '(1 2 3)) 293 ⇒ ((2 . 1) (3 . 2) (4 . 3)) 294 (-annotate 'length '(("h" "e" "l" "l" "o") ("hello" "world"))) 295 ⇒ ((5 "h" "e" "l" "l" "o") (2 "hello" "world")) 296 (--annotate (< 1 it) '(0 1 2 3)) 297 ⇒ ((nil . 0) (nil . 1) (t . 2) (t . 3)) 298 299 -- Function: -splice (pred fun list) 300 Splice lists generated by FUN in place of elements matching PRED in 301 LIST. 302 303 FUN takes the element matching PRED as input. 304 305 This function can be used as replacement for ‘,@’ in case you need 306 to splice several lists at marked positions (for example with 307 keywords). 308 309 See also: ‘-splice-list’ (*note -splice-list::), ‘-insert-at’ 310 (*note -insert-at::) 311 312 (-splice 'even? (lambda (x) (list x x)) '(1 2 3 4)) 313 ⇒ (1 2 2 3 4 4) 314 (--splice 't (list it it) '(1 2 3 4)) 315 ⇒ (1 1 2 2 3 3 4 4) 316 (--splice (equal it :magic) '((list of) (magical) (code)) '((foo) (bar) :magic (baz))) 317 ⇒ ((foo) (bar) (list of) (magical) (code) (baz)) 318 319 -- Function: -splice-list (pred new-list list) 320 Splice NEW-LIST in place of elements matching PRED in LIST. 321 322 See also: ‘-splice’ (*note -splice::), ‘-insert-at’ (*note 323 -insert-at::) 324 325 (-splice-list 'keywordp '(a b c) '(1 :foo 2)) 326 ⇒ (1 a b c 2) 327 (-splice-list 'keywordp nil '(1 :foo 2)) 328 ⇒ (1 2) 329 (--splice-list (keywordp it) '(a b c) '(1 :foo 2)) 330 ⇒ (1 a b c 2) 331 332 -- Function: -mapcat (fn list) 333 Return the concatenation of the result of mapping FN over LIST. 334 Thus function FN should return a list. 335 336 (-mapcat 'list '(1 2 3)) 337 ⇒ (1 2 3) 338 (-mapcat (lambda (item) (list 0 item)) '(1 2 3)) 339 ⇒ (0 1 0 2 0 3) 340 (--mapcat (list 0 it) '(1 2 3)) 341 ⇒ (0 1 0 2 0 3) 342 343 -- Function: -copy (list) 344 Create a shallow copy of LIST. 345 346 (-copy '(1 2 3)) 347 ⇒ (1 2 3) 348 (let ((a '(1 2 3))) (eq a (-copy a))) 349 ⇒ nil 350 351 352 File: dash.info, Node: Sublist selection, Next: List to list, Prev: Maps, Up: Functions 353 354 2.2 Sublist selection 355 ===================== 356 357 Functions returning a sublist of the original list. 358 359 -- Function: -filter (pred list) 360 Return a new list of the items in LIST for which PRED returns 361 non-nil. 362 363 Alias: ‘-select’. 364 365 This function’s anaphoric counterpart is ‘--filter’. 366 367 For similar operations, see also ‘-keep’ (*note -keep::) and 368 ‘-remove’ (*note -remove::). 369 370 (-filter (lambda (num) (= 0 (% num 2))) '(1 2 3 4)) 371 ⇒ (2 4) 372 (-filter #'natnump '(-2 -1 0 1 2)) 373 ⇒ (0 1 2) 374 (--filter (= 0 (% it 2)) '(1 2 3 4)) 375 ⇒ (2 4) 376 377 -- Function: -remove (pred list) 378 Return a new list of the items in LIST for which PRED returns nil. 379 380 Alias: ‘-reject’. 381 382 This function’s anaphoric counterpart is ‘--remove’. 383 384 For similar operations, see also ‘-keep’ (*note -keep::) and 385 ‘-filter’ (*note -filter::). 386 387 (-remove (lambda (num) (= 0 (% num 2))) '(1 2 3 4)) 388 ⇒ (1 3) 389 (-remove #'natnump '(-2 -1 0 1 2)) 390 ⇒ (-2 -1) 391 (--remove (= 0 (% it 2)) '(1 2 3 4)) 392 ⇒ (1 3) 393 394 -- Function: -remove-first (pred list) 395 Remove the first item from LIST for which PRED returns non-nil. 396 This is a non-destructive operation, but only the front of LIST 397 leading up to the removed item is a copy; the rest is LIST’s 398 original tail. If no item is removed, then the result is a 399 complete copy. 400 401 Alias: ‘-reject-first’. 402 403 This function’s anaphoric counterpart is ‘--remove-first’. 404 405 See also ‘-map-first’ (*note -map-first::), ‘-remove-item’ (*note 406 -remove-item::), and ‘-remove-last’ (*note -remove-last::). 407 408 (-remove-first #'natnump '(-2 -1 0 1 2)) 409 ⇒ (-2 -1 1 2) 410 (-remove-first #'stringp '(1 2 "first" "second")) 411 ⇒ (1 2 "second") 412 (--remove-first (> it 3) '(1 2 3 4 5 6)) 413 ⇒ (1 2 3 5 6) 414 415 -- Function: -remove-last (pred list) 416 Remove the last item from LIST for which PRED returns non-nil. The 417 result is a copy of LIST regardless of whether an element is 418 removed. 419 420 Alias: ‘-reject-last’. 421 422 This function’s anaphoric counterpart is ‘--remove-last’. 423 424 See also ‘-map-last’ (*note -map-last::), ‘-remove-item’ (*note 425 -remove-item::), and ‘-remove-first’ (*note -remove-first::). 426 427 (-remove-last #'natnump '(1 3 5 4 7 8 10 -11)) 428 ⇒ (1 3 5 4 7 8 -11) 429 (-remove-last #'stringp '(1 2 "last" "second")) 430 ⇒ (1 2 "last") 431 (--remove-last (> it 3) '(1 2 3 4 5 6 7 8 9 10)) 432 ⇒ (1 2 3 4 5 6 7 8 9) 433 434 -- Function: -remove-item (item list) 435 Return a copy of LIST with all occurrences of ITEM removed. The 436 comparison is done with ‘equal’. 437 438 (-remove-item 3 '(1 2 3 2 3 4 5 3)) 439 ⇒ (1 2 2 4 5) 440 (-remove-item 'foo '(foo bar baz foo)) 441 ⇒ (bar baz) 442 (-remove-item "bob" '("alice" "bob" "eve" "bob")) 443 ⇒ ("alice" "eve") 444 445 -- Function: -non-nil (list) 446 Return a copy of LIST with all nil items removed. 447 448 (-non-nil '(nil 1 nil 2 nil nil 3 4 nil 5 nil)) 449 ⇒ (1 2 3 4 5) 450 (-non-nil '((nil))) 451 ⇒ ((nil)) 452 (-non-nil ()) 453 ⇒ () 454 455 -- Function: -slice (list from &optional to step) 456 Return copy of LIST, starting from index FROM to index TO. 457 458 FROM or TO may be negative. These values are then interpreted 459 modulo the length of the list. 460 461 If STEP is a number, only each STEPth item in the resulting section 462 is returned. Defaults to 1. 463 464 (-slice '(1 2 3 4 5) 1) 465 ⇒ (2 3 4 5) 466 (-slice '(1 2 3 4 5) 0 3) 467 ⇒ (1 2 3) 468 (-slice '(1 2 3 4 5 6 7 8 9) 1 -1 2) 469 ⇒ (2 4 6 8) 470 471 -- Function: -take (n list) 472 Return a copy of the first N items in LIST. Return a copy of LIST 473 if it contains N items or fewer. Return nil if N is zero or less. 474 475 See also: ‘-take-last’ (*note -take-last::). 476 477 (-take 3 '(1 2 3 4 5)) 478 ⇒ (1 2 3) 479 (-take 17 '(1 2 3 4 5)) 480 ⇒ (1 2 3 4 5) 481 (-take 0 '(1 2 3 4 5)) 482 ⇒ () 483 484 -- Function: -take-last (n list) 485 Return a copy of the last N items of LIST in order. Return a copy 486 of LIST if it contains N items or fewer. Return nil if N is zero 487 or less. 488 489 See also: ‘-take’ (*note -take::). 490 491 (-take-last 3 '(1 2 3 4 5)) 492 ⇒ (3 4 5) 493 (-take-last 17 '(1 2 3 4 5)) 494 ⇒ (1 2 3 4 5) 495 (-take-last 1 '(1 2 3 4 5)) 496 ⇒ (5) 497 498 -- Function: -drop (n list) 499 Return the tail (not a copy) of LIST without the first N items. 500 Return nil if LIST contains N items or fewer. Return LIST if N is 501 zero or less. 502 503 For another variant, see also ‘-drop-last’ (*note -drop-last::). 504 505 (-drop 3 '(1 2 3 4 5)) 506 ⇒ (4 5) 507 (-drop 17 '(1 2 3 4 5)) 508 ⇒ () 509 (-drop 0 '(1 2 3 4 5)) 510 ⇒ (1 2 3 4 5) 511 512 -- Function: -drop-last (n list) 513 Return a copy of LIST without its last N items. Return a copy of 514 LIST if N is zero or less. Return nil if LIST contains N items or 515 fewer. 516 517 See also: ‘-drop’ (*note -drop::). 518 519 (-drop-last 3 '(1 2 3 4 5)) 520 ⇒ (1 2) 521 (-drop-last 17 '(1 2 3 4 5)) 522 ⇒ () 523 (-drop-last 0 '(1 2 3 4 5)) 524 ⇒ (1 2 3 4 5) 525 526 -- Function: -take-while (pred list) 527 Take successive items from LIST for which PRED returns non-nil. 528 PRED is a function of one argument. Return a new list of the 529 successive elements from the start of LIST for which PRED returns 530 non-nil. 531 532 This function’s anaphoric counterpart is ‘--take-while’. 533 534 For another variant, see also ‘-drop-while’ (*note -drop-while::). 535 536 (-take-while #'even? '(1 2 3 4)) 537 ⇒ () 538 (-take-while #'even? '(2 4 5 6)) 539 ⇒ (2 4) 540 (--take-while (< it 4) '(1 2 3 4 3 2 1)) 541 ⇒ (1 2 3) 542 543 -- Function: -drop-while (pred list) 544 Drop successive items from LIST for which PRED returns non-nil. 545 PRED is a function of one argument. Return the tail (not a copy) 546 of LIST starting from its first element for which PRED returns nil. 547 548 This function’s anaphoric counterpart is ‘--drop-while’. 549 550 For another variant, see also ‘-take-while’ (*note -take-while::). 551 552 (-drop-while #'even? '(1 2 3 4)) 553 ⇒ (1 2 3 4) 554 (-drop-while #'even? '(2 4 5 6)) 555 ⇒ (5 6) 556 (--drop-while (< it 4) '(1 2 3 4 3 2 1)) 557 ⇒ (4 3 2 1) 558 559 -- Function: -select-by-indices (indices list) 560 Return a list whose elements are elements from LIST selected as 561 ‘(nth i list)‘ for all i from INDICES. 562 563 (-select-by-indices '(4 10 2 3 6) '("v" "e" "l" "o" "c" "i" "r" "a" "p" "t" "o" "r")) 564 ⇒ ("c" "o" "l" "o" "r") 565 (-select-by-indices '(2 1 0) '("a" "b" "c")) 566 ⇒ ("c" "b" "a") 567 (-select-by-indices '(0 1 2 0 1 3 3 1) '("f" "a" "r" "l")) 568 ⇒ ("f" "a" "r" "f" "a" "l" "l" "a") 569 570 -- Function: -select-columns (columns table) 571 Select COLUMNS from TABLE. 572 573 TABLE is a list of lists where each element represents one row. It 574 is assumed each row has the same length. 575 576 Each row is transformed such that only the specified COLUMNS are 577 selected. 578 579 See also: ‘-select-column’ (*note -select-column::), 580 ‘-select-by-indices’ (*note -select-by-indices::) 581 582 (-select-columns '(0 2) '((1 2 3) (a b c) (:a :b :c))) 583 ⇒ ((1 3) (a c) (:a :c)) 584 (-select-columns '(1) '((1 2 3) (a b c) (:a :b :c))) 585 ⇒ ((2) (b) (:b)) 586 (-select-columns nil '((1 2 3) (a b c) (:a :b :c))) 587 ⇒ (nil nil nil) 588 589 -- Function: -select-column (column table) 590 Select COLUMN from TABLE. 591 592 TABLE is a list of lists where each element represents one row. It 593 is assumed each row has the same length. 594 595 The single selected column is returned as a list. 596 597 See also: ‘-select-columns’ (*note -select-columns::), 598 ‘-select-by-indices’ (*note -select-by-indices::) 599 600 (-select-column 1 '((1 2 3) (a b c) (:a :b :c))) 601 ⇒ (2 b :b) 602 603 604 File: dash.info, Node: List to list, Next: Reductions, Prev: Sublist selection, Up: Functions 605 606 2.3 List to list 607 ================ 608 609 Functions returning a modified copy of the input list. 610 611 -- Function: -keep (fn list) 612 Return a new list of the non-nil results of applying FN to each 613 item in LIST. Like ‘-filter’ (*note -filter::), but returns the 614 non-nil results of FN instead of the corresponding elements of 615 LIST. 616 617 Its anaphoric counterpart is ‘--keep’. 618 619 (-keep #'cdr '((1 2 3) (4 5) (6))) 620 ⇒ ((2 3) (5)) 621 (-keep (lambda (n) (and (> n 3) (* 10 n))) '(1 2 3 4 5 6)) 622 ⇒ (40 50 60) 623 (--keep (and (> it 3) (* 10 it)) '(1 2 3 4 5 6)) 624 ⇒ (40 50 60) 625 626 -- Function: -concat (&rest lists) 627 Return a new list with the concatenation of the elements in the 628 supplied LISTS. 629 630 (-concat '(1)) 631 ⇒ (1) 632 (-concat '(1) '(2)) 633 ⇒ (1 2) 634 (-concat '(1) '(2 3) '(4)) 635 ⇒ (1 2 3 4) 636 637 -- Function: -flatten (l) 638 Take a nested list L and return its contents as a single, flat 639 list. 640 641 Note that because ‘nil’ represents a list of zero elements (an 642 empty list), any mention of nil in L will disappear after 643 flattening. If you need to preserve nils, consider ‘-flatten-n’ 644 (*note -flatten-n::) or map them to some unique symbol and then map 645 them back. 646 647 Conses of two atoms are considered "terminals", that is, they 648 aren’t flattened further. 649 650 See also: ‘-flatten-n’ (*note -flatten-n::) 651 652 (-flatten '((1))) 653 ⇒ (1) 654 (-flatten '((1 (2 3) (((4 (5))))))) 655 ⇒ (1 2 3 4 5) 656 (-flatten '(1 2 (3 . 4))) 657 ⇒ (1 2 (3 . 4)) 658 659 -- Function: -flatten-n (num list) 660 Flatten NUM levels of a nested LIST. 661 662 See also: ‘-flatten’ (*note -flatten::) 663 664 (-flatten-n 1 '((1 2) ((3 4) ((5 6))))) 665 ⇒ (1 2 (3 4) ((5 6))) 666 (-flatten-n 2 '((1 2) ((3 4) ((5 6))))) 667 ⇒ (1 2 3 4 (5 6)) 668 (-flatten-n 3 '((1 2) ((3 4) ((5 6))))) 669 ⇒ (1 2 3 4 5 6) 670 671 -- Function: -replace (old new list) 672 Replace all OLD items in LIST with NEW. 673 674 Elements are compared using ‘equal’. 675 676 See also: ‘-replace-at’ (*note -replace-at::) 677 678 (-replace 1 "1" '(1 2 3 4 3 2 1)) 679 ⇒ ("1" 2 3 4 3 2 "1") 680 (-replace "foo" "bar" '("a" "nice" "foo" "sentence" "about" "foo")) 681 ⇒ ("a" "nice" "bar" "sentence" "about" "bar") 682 (-replace 1 2 nil) 683 ⇒ nil 684 685 -- Function: -replace-first (old new list) 686 Replace the first occurrence of OLD with NEW in LIST. 687 688 Elements are compared using ‘equal’. 689 690 See also: ‘-map-first’ (*note -map-first::) 691 692 (-replace-first 1 "1" '(1 2 3 4 3 2 1)) 693 ⇒ ("1" 2 3 4 3 2 1) 694 (-replace-first "foo" "bar" '("a" "nice" "foo" "sentence" "about" "foo")) 695 ⇒ ("a" "nice" "bar" "sentence" "about" "foo") 696 (-replace-first 1 2 nil) 697 ⇒ nil 698 699 -- Function: -replace-last (old new list) 700 Replace the last occurrence of OLD with NEW in LIST. 701 702 Elements are compared using ‘equal’. 703 704 See also: ‘-map-last’ (*note -map-last::) 705 706 (-replace-last 1 "1" '(1 2 3 4 3 2 1)) 707 ⇒ (1 2 3 4 3 2 "1") 708 (-replace-last "foo" "bar" '("a" "nice" "foo" "sentence" "about" "foo")) 709 ⇒ ("a" "nice" "foo" "sentence" "about" "bar") 710 (-replace-last 1 2 nil) 711 ⇒ nil 712 713 -- Function: -insert-at (n x list) 714 Return a list with X inserted into LIST at position N. 715 716 See also: ‘-splice’ (*note -splice::), ‘-splice-list’ (*note 717 -splice-list::) 718 719 (-insert-at 1 'x '(a b c)) 720 ⇒ (a x b c) 721 (-insert-at 12 'x '(a b c)) 722 ⇒ (a b c x) 723 724 -- Function: -replace-at (n x list) 725 Return a list with element at Nth position in LIST replaced with X. 726 727 See also: ‘-replace’ (*note -replace::) 728 729 (-replace-at 0 9 '(0 1 2 3 4 5)) 730 ⇒ (9 1 2 3 4 5) 731 (-replace-at 1 9 '(0 1 2 3 4 5)) 732 ⇒ (0 9 2 3 4 5) 733 (-replace-at 4 9 '(0 1 2 3 4 5)) 734 ⇒ (0 1 2 3 9 5) 735 736 -- Function: -update-at (n func list) 737 Return a list with element at Nth position in LIST replaced with 738 ‘(func (nth n list))‘. 739 740 See also: ‘-map-when’ (*note -map-when::) 741 742 (-update-at 0 (lambda (x) (+ x 9)) '(0 1 2 3 4 5)) 743 ⇒ (9 1 2 3 4 5) 744 (-update-at 1 (lambda (x) (+ x 8)) '(0 1 2 3 4 5)) 745 ⇒ (0 9 2 3 4 5) 746 (--update-at 2 (length it) '("foo" "bar" "baz" "quux")) 747 ⇒ ("foo" "bar" 3 "quux") 748 749 -- Function: -remove-at (n list) 750 Return a list with element at Nth position in LIST removed. 751 752 See also: ‘-remove-at-indices’ (*note -remove-at-indices::), 753 ‘-remove’ (*note -remove::) 754 755 (-remove-at 0 '("0" "1" "2" "3" "4" "5")) 756 ⇒ ("1" "2" "3" "4" "5") 757 (-remove-at 1 '("0" "1" "2" "3" "4" "5")) 758 ⇒ ("0" "2" "3" "4" "5") 759 (-remove-at 2 '("0" "1" "2" "3" "4" "5")) 760 ⇒ ("0" "1" "3" "4" "5") 761 762 -- Function: -remove-at-indices (indices list) 763 Return a list whose elements are elements from LIST without 764 elements selected as ‘(nth i list)‘ for all i from INDICES. 765 766 See also: ‘-remove-at’ (*note -remove-at::), ‘-remove’ (*note 767 -remove::) 768 769 (-remove-at-indices '(0) '("0" "1" "2" "3" "4" "5")) 770 ⇒ ("1" "2" "3" "4" "5") 771 (-remove-at-indices '(0 2 4) '("0" "1" "2" "3" "4" "5")) 772 ⇒ ("1" "3" "5") 773 (-remove-at-indices '(0 5) '("0" "1" "2" "3" "4" "5")) 774 ⇒ ("1" "2" "3" "4") 775 776 777 File: dash.info, Node: Reductions, Next: Unfolding, Prev: List to list, Up: Functions 778 779 2.4 Reductions 780 ============== 781 782 Functions reducing lists to a single value (which may also be a list). 783 784 -- Function: -reduce-from (fn init list) 785 Reduce the function FN across LIST, starting with INIT. Return the 786 result of applying FN to INIT and the first element of LIST, then 787 applying FN to that result and the second element, etc. If LIST is 788 empty, return INIT without calling FN. 789 790 This function’s anaphoric counterpart is ‘--reduce-from’. 791 792 For other folds, see also ‘-reduce’ (*note -reduce::) and 793 ‘-reduce-r’ (*note -reduce-r::). 794 795 (-reduce-from #'- 10 '(1 2 3)) 796 ⇒ 4 797 (-reduce-from #'list 10 '(1 2 3)) 798 ⇒ (((10 1) 2) 3) 799 (--reduce-from (concat acc " " it) "START" '("a" "b" "c")) 800 ⇒ "START a b c" 801 802 -- Function: -reduce-r-from (fn init list) 803 Reduce the function FN across LIST in reverse, starting with INIT. 804 Return the result of applying FN to the last element of LIST and 805 INIT, then applying FN to the second-to-last element and the 806 previous result of FN, etc. That is, the first argument of FN is 807 the current element, and its second argument the accumulated value. 808 If LIST is empty, return INIT without calling FN. 809 810 This function is like ‘-reduce-from’ (*note -reduce-from::) but the 811 operation associates from the right rather than left. In other 812 words, it starts from the end of LIST and flips the arguments to 813 FN. Conceptually, it is like replacing the conses in LIST with 814 applications of FN, and its last link with INIT, and evaluating the 815 resulting expression. 816 817 This function’s anaphoric counterpart is ‘--reduce-r-from’. 818 819 For other folds, see also ‘-reduce-r’ (*note -reduce-r::) and 820 ‘-reduce’ (*note -reduce::). 821 822 (-reduce-r-from #'- 10 '(1 2 3)) 823 ⇒ -8 824 (-reduce-r-from #'list 10 '(1 2 3)) 825 ⇒ (1 (2 (3 10))) 826 (--reduce-r-from (concat it " " acc) "END" '("a" "b" "c")) 827 ⇒ "a b c END" 828 829 -- Function: -reduce (fn list) 830 Reduce the function FN across LIST. Return the result of applying 831 FN to the first two elements of LIST, then applying FN to that 832 result and the third element, etc. If LIST contains a single 833 element, return it without calling FN. If LIST is empty, return 834 the result of calling FN with no arguments. 835 836 This function’s anaphoric counterpart is ‘--reduce’. 837 838 For other folds, see also ‘-reduce-from’ (*note -reduce-from::) and 839 ‘-reduce-r’ (*note -reduce-r::). 840 841 (-reduce #'- '(1 2 3 4)) 842 ⇒ -8 843 (-reduce #'list '(1 2 3 4)) 844 ⇒ (((1 2) 3) 4) 845 (--reduce (format "%s-%d" acc it) '(1 2 3)) 846 ⇒ "1-2-3" 847 848 -- Function: -reduce-r (fn list) 849 Reduce the function FN across LIST in reverse. Return the result 850 of applying FN to the last two elements of LIST, then applying FN 851 to the third-to-last element and the previous result of FN, etc. 852 That is, the first argument of FN is the current element, and its 853 second argument the accumulated value. If LIST contains a single 854 element, return it without calling FN. If LIST is empty, return 855 the result of calling FN with no arguments. 856 857 This function is like ‘-reduce’ (*note -reduce::) but the operation 858 associates from the right rather than left. In other words, it 859 starts from the end of LIST and flips the arguments to FN. 860 Conceptually, it is like replacing the conses in LIST with 861 applications of FN, ignoring its last link, and evaluating the 862 resulting expression. 863 864 This function’s anaphoric counterpart is ‘--reduce-r’. 865 866 For other folds, see also ‘-reduce-r-from’ (*note -reduce-r-from::) 867 and ‘-reduce’ (*note -reduce::). 868 869 (-reduce-r #'- '(1 2 3 4)) 870 ⇒ -2 871 (-reduce-r #'list '(1 2 3 4)) 872 ⇒ (1 (2 (3 4))) 873 (--reduce-r (format "%s-%d" acc it) '(1 2 3)) 874 ⇒ "3-2-1" 875 876 -- Function: -reductions-from (fn init list) 877 Return a list of FN’s intermediate reductions across LIST. That 878 is, a list of the intermediate values of the accumulator when 879 ‘-reduce-from’ (*note -reduce-from::) (which see) is called with 880 the same arguments. 881 882 This function’s anaphoric counterpart is ‘--reductions-from’. 883 884 For other folds, see also ‘-reductions’ (*note -reductions::) and 885 ‘-reductions-r’ (*note -reductions-r::). 886 887 (-reductions-from #'max 0 '(2 1 4 3)) 888 ⇒ (0 2 2 4 4) 889 (-reductions-from #'* 1 '(1 2 3 4)) 890 ⇒ (1 1 2 6 24) 891 (--reductions-from (format "(FN %s %d)" acc it) "INIT" '(1 2 3)) 892 ⇒ ("INIT" "(FN INIT 1)" "(FN (FN INIT 1) 2)" "(FN (FN (FN INIT 1) 2) 3)") 893 894 -- Function: -reductions-r-from (fn init list) 895 Return a list of FN’s intermediate reductions across reversed LIST. 896 That is, a list of the intermediate values of the accumulator when 897 ‘-reduce-r-from’ (*note -reduce-r-from::) (which see) is called 898 with the same arguments. 899 900 This function’s anaphoric counterpart is ‘--reductions-r-from’. 901 902 For other folds, see also ‘-reductions’ (*note -reductions::) and 903 ‘-reductions-r’ (*note -reductions-r::). 904 905 (-reductions-r-from #'max 0 '(2 1 4 3)) 906 ⇒ (4 4 4 3 0) 907 (-reductions-r-from #'* 1 '(1 2 3 4)) 908 ⇒ (24 24 12 4 1) 909 (--reductions-r-from (format "(FN %d %s)" it acc) "INIT" '(1 2 3)) 910 ⇒ ("(FN 1 (FN 2 (FN 3 INIT)))" "(FN 2 (FN 3 INIT))" "(FN 3 INIT)" "INIT") 911 912 -- Function: -reductions (fn list) 913 Return a list of FN’s intermediate reductions across LIST. That 914 is, a list of the intermediate values of the accumulator when 915 ‘-reduce’ (*note -reduce::) (which see) is called with the same 916 arguments. 917 918 This function’s anaphoric counterpart is ‘--reductions’. 919 920 For other folds, see also ‘-reductions’ (*note -reductions::) and 921 ‘-reductions-r’ (*note -reductions-r::). 922 923 (-reductions #'+ '(1 2 3 4)) 924 ⇒ (1 3 6 10) 925 (-reductions #'* '(1 2 3 4)) 926 ⇒ (1 2 6 24) 927 (--reductions (format "(FN %s %d)" acc it) '(1 2 3)) 928 ⇒ (1 "(FN 1 2)" "(FN (FN 1 2) 3)") 929 930 -- Function: -reductions-r (fn list) 931 Return a list of FN’s intermediate reductions across reversed LIST. 932 That is, a list of the intermediate values of the accumulator when 933 ‘-reduce-r’ (*note -reduce-r::) (which see) is called with the same 934 arguments. 935 936 This function’s anaphoric counterpart is ‘--reductions-r’. 937 938 For other folds, see also ‘-reductions-r-from’ (*note 939 -reductions-r-from::) and ‘-reductions’ (*note -reductions::). 940 941 (-reductions-r #'+ '(1 2 3 4)) 942 ⇒ (10 9 7 4) 943 (-reductions-r #'* '(1 2 3 4)) 944 ⇒ (24 24 12 4) 945 (--reductions-r (format "(FN %d %s)" it acc) '(1 2 3)) 946 ⇒ ("(FN 1 (FN 2 3))" "(FN 2 3)" 3) 947 948 -- Function: -count (pred list) 949 Counts the number of items in LIST where (PRED item) is non-nil. 950 951 (-count 'even? '(1 2 3 4 5)) 952 ⇒ 2 953 (--count (< it 4) '(1 2 3 4)) 954 ⇒ 3 955 956 -- Function: -sum (list) 957 Return the sum of LIST. 958 959 (-sum ()) 960 ⇒ 0 961 (-sum '(1)) 962 ⇒ 1 963 (-sum '(1 2 3 4)) 964 ⇒ 10 965 966 -- Function: -running-sum (list) 967 Return a list with running sums of items in LIST. LIST must be 968 non-empty. 969 970 (-running-sum '(1 2 3 4)) 971 ⇒ (1 3 6 10) 972 (-running-sum '(1)) 973 ⇒ (1) 974 (-running-sum ()) 975 error→ Wrong type argument: consp, nil 976 977 -- Function: -product (list) 978 Return the product of LIST. 979 980 (-product ()) 981 ⇒ 1 982 (-product '(1)) 983 ⇒ 1 984 (-product '(1 2 3 4)) 985 ⇒ 24 986 987 -- Function: -running-product (list) 988 Return a list with running products of items in LIST. LIST must be 989 non-empty. 990 991 (-running-product '(1 2 3 4)) 992 ⇒ (1 2 6 24) 993 (-running-product '(1)) 994 ⇒ (1) 995 (-running-product ()) 996 error→ Wrong type argument: consp, nil 997 998 -- Function: -inits (list) 999 Return all prefixes of LIST. 1000 1001 (-inits '(1 2 3 4)) 1002 ⇒ (nil (1) (1 2) (1 2 3) (1 2 3 4)) 1003 (-inits nil) 1004 ⇒ (nil) 1005 (-inits '(1)) 1006 ⇒ (nil (1)) 1007 1008 -- Function: -tails (list) 1009 Return all suffixes of LIST 1010 1011 (-tails '(1 2 3 4)) 1012 ⇒ ((1 2 3 4) (2 3 4) (3 4) (4) nil) 1013 (-tails nil) 1014 ⇒ (nil) 1015 (-tails '(1)) 1016 ⇒ ((1) nil) 1017 1018 -- Function: -common-prefix (&rest lists) 1019 Return the longest common prefix of LISTS. 1020 1021 (-common-prefix '(1)) 1022 ⇒ (1) 1023 (-common-prefix '(1 2) '(3 4) '(1 2)) 1024 ⇒ () 1025 (-common-prefix '(1 2) '(1 2 3) '(1 2 3 4)) 1026 ⇒ (1 2) 1027 1028 -- Function: -common-suffix (&rest lists) 1029 Return the longest common suffix of LISTS. 1030 1031 (-common-suffix '(1)) 1032 ⇒ (1) 1033 (-common-suffix '(1 2) '(3 4) '(1 2)) 1034 ⇒ () 1035 (-common-suffix '(1 2 3 4) '(2 3 4) '(3 4)) 1036 ⇒ (3 4) 1037 1038 -- Function: -min (list) 1039 Return the smallest value from LIST of numbers or markers. 1040 1041 (-min '(0)) 1042 ⇒ 0 1043 (-min '(3 2 1)) 1044 ⇒ 1 1045 (-min '(1 2 3)) 1046 ⇒ 1 1047 1048 -- Function: -min-by (comparator list) 1049 Take a comparison function COMPARATOR and a LIST and return the 1050 least element of the list by the comparison function. 1051 1052 See also combinator ‘-on’ (*note -on::) which can transform the 1053 values before comparing them. 1054 1055 (-min-by '> '(4 3 6 1)) 1056 ⇒ 1 1057 (--min-by (> (car it) (car other)) '((1 2 3) (2) (3 2))) 1058 ⇒ (1 2 3) 1059 (--min-by (> (length it) (length other)) '((1 2 3) (2) (3 2))) 1060 ⇒ (2) 1061 1062 -- Function: -max (list) 1063 Return the largest value from LIST of numbers or markers. 1064 1065 (-max '(0)) 1066 ⇒ 0 1067 (-max '(3 2 1)) 1068 ⇒ 3 1069 (-max '(1 2 3)) 1070 ⇒ 3 1071 1072 -- Function: -max-by (comparator list) 1073 Take a comparison function COMPARATOR and a LIST and return the 1074 greatest element of the list by the comparison function. 1075 1076 See also combinator ‘-on’ (*note -on::) which can transform the 1077 values before comparing them. 1078 1079 (-max-by '> '(4 3 6 1)) 1080 ⇒ 6 1081 (--max-by (> (car it) (car other)) '((1 2 3) (2) (3 2))) 1082 ⇒ (3 2) 1083 (--max-by (> (length it) (length other)) '((1 2 3) (2) (3 2))) 1084 ⇒ (1 2 3) 1085 1086 1087 File: dash.info, Node: Unfolding, Next: Predicates, Prev: Reductions, Up: Functions 1088 1089 2.5 Unfolding 1090 ============= 1091 1092 Operations dual to reductions, building lists from a seed value rather 1093 than consuming a list to produce a single value. 1094 1095 -- Function: -iterate (fun init n) 1096 Return a list of iterated applications of FUN to INIT. 1097 1098 This means a list of the form: 1099 1100 (INIT (FUN INIT) (FUN (FUN INIT)) ...) 1101 1102 N is the length of the returned list. 1103 1104 (-iterate #'1+ 1 10) 1105 ⇒ (1 2 3 4 5 6 7 8 9 10) 1106 (-iterate (lambda (x) (+ x x)) 2 5) 1107 ⇒ (2 4 8 16 32) 1108 (--iterate (* it it) 2 5) 1109 ⇒ (2 4 16 256 65536) 1110 1111 -- Function: -unfold (fun seed) 1112 Build a list from SEED using FUN. 1113 1114 This is "dual" operation to ‘-reduce-r’ (*note -reduce-r::): while 1115 -reduce-r consumes a list to produce a single value, ‘-unfold’ 1116 (*note -unfold::) takes a seed value and builds a (potentially 1117 infinite!) list. 1118 1119 FUN should return ‘nil’ to stop the generating process, or a cons 1120 (A . B), where A will be prepended to the result and B is the new 1121 seed. 1122 1123 (-unfold (lambda (x) (unless (= x 0) (cons x (1- x)))) 10) 1124 ⇒ (10 9 8 7 6 5 4 3 2 1) 1125 (--unfold (when it (cons it (cdr it))) '(1 2 3 4)) 1126 ⇒ ((1 2 3 4) (2 3 4) (3 4) (4)) 1127 (--unfold (when it (cons it (butlast it))) '(1 2 3 4)) 1128 ⇒ ((1 2 3 4) (1 2 3) (1 2) (1)) 1129 1130 1131 File: dash.info, Node: Predicates, Next: Partitioning, Prev: Unfolding, Up: Functions 1132 1133 2.6 Predicates 1134 ============== 1135 1136 Reductions of one or more lists to a boolean value. 1137 1138 -- Function: -some (pred list) 1139 Return (PRED x) for the first LIST item where (PRED x) is non-nil, 1140 else nil. 1141 1142 Alias: ‘-any’. 1143 1144 This function’s anaphoric counterpart is ‘--some’. 1145 1146 (-some #'stringp '(1 "2" 3)) 1147 ⇒ t 1148 (--some (string-match-p "x" it) '("foo" "axe" "xor")) 1149 ⇒ 1 1150 (--some (= it-index 3) '(0 1 2)) 1151 ⇒ nil 1152 1153 -- Function: -every (pred list) 1154 Return non-nil if PRED returns non-nil for all items in LIST. If 1155 so, return the last such result of PRED. Otherwise, once an item 1156 is reached for which PRED returns nil, return nil without calling 1157 PRED on any further LIST elements. 1158 1159 This function is like ‘-every-p’, but on success returns the last 1160 non-nil result of PRED instead of just t. 1161 1162 This function’s anaphoric counterpart is ‘--every’. 1163 1164 (-every #'numberp '(1 2 3)) 1165 ⇒ t 1166 (--every (string-match-p "x" it) '("axe" "xor")) 1167 ⇒ 0 1168 (--every (= it it-index) '(0 1 3)) 1169 ⇒ nil 1170 1171 -- Function: -any? (pred list) 1172 Return t if (PRED x) is non-nil for any x in LIST, else nil. 1173 1174 Alias: ‘-any-p’, ‘-some?’, ‘-some-p’ 1175 1176 (-any? #'numberp '(nil 0 t)) 1177 ⇒ t 1178 (-any? #'numberp '(nil t t)) 1179 ⇒ nil 1180 (-any? #'null '(1 3 5)) 1181 ⇒ nil 1182 1183 -- Function: -all? (pred list) 1184 Return t if (PRED X) is non-nil for all X in LIST, else nil. In 1185 the latter case, stop after the first X for which (PRED X) is nil, 1186 without calling PRED on any subsequent elements of LIST. 1187 1188 The similar function ‘-every’ (*note -every::) is more widely 1189 useful, since it returns the last non-nil result of PRED instead of 1190 just t on success. 1191 1192 Alias: ‘-all-p’, ‘-every-p’, ‘-every?’. 1193 1194 This function’s anaphoric counterpart is ‘--all?’. 1195 1196 (-all? #'numberp '(1 2 3)) 1197 ⇒ t 1198 (-all? #'numberp '(2 t 6)) 1199 ⇒ nil 1200 (--all? (= 0 (% it 2)) '(2 4 6)) 1201 ⇒ t 1202 1203 -- Function: -none? (pred list) 1204 Return t if (PRED x) is nil for all x in LIST, else nil. 1205 1206 Alias: ‘-none-p’ 1207 1208 (-none? 'even? '(1 2 3)) 1209 ⇒ nil 1210 (-none? 'even? '(1 3 5)) 1211 ⇒ t 1212 (--none? (= 0 (% it 2)) '(1 2 3)) 1213 ⇒ nil 1214 1215 -- Function: -only-some? (pred list) 1216 Return ‘t‘ if at least one item of LIST matches PRED and at least 1217 one item of LIST does not match PRED. Return ‘nil‘ both if all 1218 items match the predicate or if none of the items match the 1219 predicate. 1220 1221 Alias: ‘-only-some-p’ 1222 1223 (-only-some? 'even? '(1 2 3)) 1224 ⇒ t 1225 (-only-some? 'even? '(1 3 5)) 1226 ⇒ nil 1227 (-only-some? 'even? '(2 4 6)) 1228 ⇒ nil 1229 1230 -- Function: -contains? (list element) 1231 Return non-nil if LIST contains ELEMENT. 1232 1233 The test for equality is done with ‘equal’, or with ‘-compare-fn’ 1234 if that’s non-nil. 1235 1236 Alias: ‘-contains-p’ 1237 1238 (-contains? '(1 2 3) 1) 1239 ⇒ t 1240 (-contains? '(1 2 3) 2) 1241 ⇒ t 1242 (-contains? '(1 2 3) 4) 1243 ⇒ nil 1244 1245 -- Function: -same-items? (list list2) 1246 Return true if LIST and LIST2 has the same items. 1247 1248 The order of the elements in the lists does not matter. 1249 1250 Alias: ‘-same-items-p’ 1251 1252 (-same-items? '(1 2 3) '(1 2 3)) 1253 ⇒ t 1254 (-same-items? '(1 2 3) '(3 2 1)) 1255 ⇒ t 1256 (-same-items? '(1 2 3) '(1 2 3 4)) 1257 ⇒ nil 1258 1259 -- Function: -is-prefix? (prefix list) 1260 Return non-nil if PREFIX is a prefix of LIST. 1261 1262 Alias: ‘-is-prefix-p’. 1263 1264 (-is-prefix? '(1 2 3) '(1 2 3 4 5)) 1265 ⇒ t 1266 (-is-prefix? '(1 2 3 4 5) '(1 2 3)) 1267 ⇒ nil 1268 (-is-prefix? '(1 3) '(1 2 3 4 5)) 1269 ⇒ nil 1270 1271 -- Function: -is-suffix? (suffix list) 1272 Return non-nil if SUFFIX is a suffix of LIST. 1273 1274 Alias: ‘-is-suffix-p’. 1275 1276 (-is-suffix? '(3 4 5) '(1 2 3 4 5)) 1277 ⇒ t 1278 (-is-suffix? '(1 2 3 4 5) '(3 4 5)) 1279 ⇒ nil 1280 (-is-suffix? '(3 5) '(1 2 3 4 5)) 1281 ⇒ nil 1282 1283 -- Function: -is-infix? (infix list) 1284 Return non-nil if INFIX is infix of LIST. 1285 1286 This operation runs in O(n^2) time 1287 1288 Alias: ‘-is-infix-p’ 1289 1290 (-is-infix? '(1 2 3) '(1 2 3 4 5)) 1291 ⇒ t 1292 (-is-infix? '(2 3 4) '(1 2 3 4 5)) 1293 ⇒ t 1294 (-is-infix? '(3 4 5) '(1 2 3 4 5)) 1295 ⇒ t 1296 1297 -- Function: -cons-pair? (obj) 1298 Return non-nil if OBJ is a true cons pair. That is, a cons (A . 1299 B) where B is not a list. 1300 1301 Alias: ‘-cons-pair-p’. 1302 1303 (-cons-pair? '(1 . 2)) 1304 ⇒ t 1305 (-cons-pair? '(1 2)) 1306 ⇒ nil 1307 (-cons-pair? '(1)) 1308 ⇒ nil 1309 1310 1311 File: dash.info, Node: Partitioning, Next: Indexing, Prev: Predicates, Up: Functions 1312 1313 2.7 Partitioning 1314 ================ 1315 1316 Functions partitioning the input list into a list of lists. 1317 1318 -- Function: -split-at (n list) 1319 Split LIST into two sublists after the Nth element. The result is 1320 a list of two elements (TAKE DROP) where TAKE is a new list of the 1321 first N elements of LIST, and DROP is the remaining elements of 1322 LIST (not a copy). TAKE and DROP are like the results of ‘-take’ 1323 (*note -take::) and ‘-drop’ (*note -drop::), respectively, but the 1324 split is done in a single list traversal. 1325 1326 (-split-at 3 '(1 2 3 4 5)) 1327 ⇒ ((1 2 3) (4 5)) 1328 (-split-at 17 '(1 2 3 4 5)) 1329 ⇒ ((1 2 3 4 5) nil) 1330 (-split-at 0 '(1 2 3 4 5)) 1331 ⇒ (nil (1 2 3 4 5)) 1332 1333 -- Function: -split-with (pred list) 1334 Return a list of ((-take-while PRED LIST) (-drop-while PRED LIST)), 1335 in no more than one pass through the list. 1336 1337 (-split-with 'even? '(1 2 3 4)) 1338 ⇒ (nil (1 2 3 4)) 1339 (-split-with 'even? '(2 4 5 6)) 1340 ⇒ ((2 4) (5 6)) 1341 (--split-with (< it 4) '(1 2 3 4 3 2 1)) 1342 ⇒ ((1 2 3) (4 3 2 1)) 1343 1344 -- Macro: -split-on (item list) 1345 Split the LIST each time ITEM is found. 1346 1347 Unlike ‘-partition-by’ (*note -partition-by::), the ITEM is 1348 discarded from the results. Empty lists are also removed from the 1349 result. 1350 1351 Comparison is done by ‘equal’. 1352 1353 See also ‘-split-when’ (*note -split-when::) 1354 1355 (-split-on '| '(Nil | Leaf a | Node [Tree a])) 1356 ⇒ ((Nil) (Leaf a) (Node [Tree a])) 1357 (-split-on :endgroup '("a" "b" :endgroup "c" :endgroup "d" "e")) 1358 ⇒ (("a" "b") ("c") ("d" "e")) 1359 (-split-on :endgroup '("a" "b" :endgroup :endgroup "d" "e")) 1360 ⇒ (("a" "b") ("d" "e")) 1361 1362 -- Function: -split-when (fn list) 1363 Split the LIST on each element where FN returns non-nil. 1364 1365 Unlike ‘-partition-by’ (*note -partition-by::), the "matched" 1366 element is discarded from the results. Empty lists are also 1367 removed from the result. 1368 1369 This function can be thought of as a generalization of 1370 ‘split-string’. 1371 1372 (-split-when 'even? '(1 2 3 4 5 6)) 1373 ⇒ ((1) (3) (5)) 1374 (-split-when 'even? '(1 2 3 4 6 8 9)) 1375 ⇒ ((1) (3) (9)) 1376 (--split-when (memq it '(&optional &rest)) '(a b &optional c d &rest args)) 1377 ⇒ ((a b) (c d) (args)) 1378 1379 -- Function: -separate (pred list) 1380 Return a list of ((-filter PRED LIST) (-remove PRED LIST)), in one 1381 pass through the list. 1382 1383 (-separate (lambda (num) (= 0 (% num 2))) '(1 2 3 4 5 6 7)) 1384 ⇒ ((2 4 6) (1 3 5 7)) 1385 (--separate (< it 5) '(3 7 5 9 3 2 1 4 6)) 1386 ⇒ ((3 3 2 1 4) (7 5 9 6)) 1387 (-separate 'cdr '((1 2) (1) (1 2 3) (4))) 1388 ⇒ (((1 2) (1 2 3)) ((1) (4))) 1389 1390 -- Function: -partition (n list) 1391 Return a new list with the items in LIST grouped into N-sized 1392 sublists. If there are not enough items to make the last group 1393 N-sized, those items are discarded. 1394 1395 (-partition 2 '(1 2 3 4 5 6)) 1396 ⇒ ((1 2) (3 4) (5 6)) 1397 (-partition 2 '(1 2 3 4 5 6 7)) 1398 ⇒ ((1 2) (3 4) (5 6)) 1399 (-partition 3 '(1 2 3 4 5 6 7)) 1400 ⇒ ((1 2 3) (4 5 6)) 1401 1402 -- Function: -partition-all (n list) 1403 Return a new list with the items in LIST grouped into N-sized 1404 sublists. The last group may contain less than N items. 1405 1406 (-partition-all 2 '(1 2 3 4 5 6)) 1407 ⇒ ((1 2) (3 4) (5 6)) 1408 (-partition-all 2 '(1 2 3 4 5 6 7)) 1409 ⇒ ((1 2) (3 4) (5 6) (7)) 1410 (-partition-all 3 '(1 2 3 4 5 6 7)) 1411 ⇒ ((1 2 3) (4 5 6) (7)) 1412 1413 -- Function: -partition-in-steps (n step list) 1414 Return a new list with the items in LIST grouped into N-sized 1415 sublists at offsets STEP apart. If there are not enough items to 1416 make the last group N-sized, those items are discarded. 1417 1418 (-partition-in-steps 2 1 '(1 2 3 4)) 1419 ⇒ ((1 2) (2 3) (3 4)) 1420 (-partition-in-steps 3 2 '(1 2 3 4)) 1421 ⇒ ((1 2 3)) 1422 (-partition-in-steps 3 2 '(1 2 3 4 5)) 1423 ⇒ ((1 2 3) (3 4 5)) 1424 1425 -- Function: -partition-all-in-steps (n step list) 1426 Return a new list with the items in LIST grouped into N-sized 1427 sublists at offsets STEP apart. The last groups may contain less 1428 than N items. 1429 1430 (-partition-all-in-steps 2 1 '(1 2 3 4)) 1431 ⇒ ((1 2) (2 3) (3 4) (4)) 1432 (-partition-all-in-steps 3 2 '(1 2 3 4)) 1433 ⇒ ((1 2 3) (3 4)) 1434 (-partition-all-in-steps 3 2 '(1 2 3 4 5)) 1435 ⇒ ((1 2 3) (3 4 5) (5)) 1436 1437 -- Function: -partition-by (fn list) 1438 Apply FN to each item in LIST, splitting it each time FN returns a 1439 new value. 1440 1441 (-partition-by 'even? ()) 1442 ⇒ () 1443 (-partition-by 'even? '(1 1 2 2 2 3 4 6 8)) 1444 ⇒ ((1 1) (2 2 2) (3) (4 6 8)) 1445 (--partition-by (< it 3) '(1 2 3 4 3 2 1)) 1446 ⇒ ((1 2) (3 4 3) (2 1)) 1447 1448 -- Function: -partition-by-header (fn list) 1449 Apply FN to the first item in LIST. That is the header value. 1450 Apply FN to each item in LIST, splitting it each time FN returns 1451 the header value, but only after seeing at least one other value 1452 (the body). 1453 1454 (--partition-by-header (= it 1) '(1 2 3 1 2 1 2 3 4)) 1455 ⇒ ((1 2 3) (1 2) (1 2 3 4)) 1456 (--partition-by-header (> it 0) '(1 2 0 1 0 1 2 3 0)) 1457 ⇒ ((1 2 0) (1 0) (1 2 3 0)) 1458 (-partition-by-header 'even? '(2 1 1 1 4 1 3 5 6 6 1)) 1459 ⇒ ((2 1 1 1) (4 1 3 5) (6 6 1)) 1460 1461 -- Function: -partition-after-pred (pred list) 1462 Partition LIST after each element for which PRED returns non-nil. 1463 1464 This function’s anaphoric counterpart is ‘--partition-after-pred’. 1465 1466 (-partition-after-pred #'booleanp ()) 1467 ⇒ () 1468 (-partition-after-pred #'booleanp '(t t)) 1469 ⇒ ((t) (t)) 1470 (-partition-after-pred #'booleanp '(0 0 t t 0 t)) 1471 ⇒ ((0 0 t) (t) (0 t)) 1472 1473 -- Function: -partition-before-pred (pred list) 1474 Partition directly before each time PRED is true on an element of 1475 LIST. 1476 1477 (-partition-before-pred #'booleanp ()) 1478 ⇒ () 1479 (-partition-before-pred #'booleanp '(0 t)) 1480 ⇒ ((0) (t)) 1481 (-partition-before-pred #'booleanp '(0 0 t 0 t t)) 1482 ⇒ ((0 0) (t 0) (t) (t)) 1483 1484 -- Function: -partition-before-item (item list) 1485 Partition directly before each time ITEM appears in LIST. 1486 1487 (-partition-before-item 3 ()) 1488 ⇒ () 1489 (-partition-before-item 3 '(1)) 1490 ⇒ ((1)) 1491 (-partition-before-item 3 '(3)) 1492 ⇒ ((3)) 1493 1494 -- Function: -partition-after-item (item list) 1495 Partition directly after each time ITEM appears in LIST. 1496 1497 (-partition-after-item 3 ()) 1498 ⇒ () 1499 (-partition-after-item 3 '(1)) 1500 ⇒ ((1)) 1501 (-partition-after-item 3 '(3)) 1502 ⇒ ((3)) 1503 1504 -- Function: -group-by (fn list) 1505 Separate LIST into an alist whose keys are FN applied to the 1506 elements of LIST. Keys are compared by ‘equal’. 1507 1508 (-group-by 'even? ()) 1509 ⇒ () 1510 (-group-by 'even? '(1 1 2 2 2 3 4 6 8)) 1511 ⇒ ((nil 1 1 3) (t 2 2 2 4 6 8)) 1512 (--group-by (car (split-string it "/")) '("a/b" "c/d" "a/e")) 1513 ⇒ (("a" "a/b" "a/e") ("c" "c/d")) 1514 1515 1516 File: dash.info, Node: Indexing, Next: Set operations, Prev: Partitioning, Up: Functions 1517 1518 2.8 Indexing 1519 ============ 1520 1521 Functions retrieving or sorting based on list indices and related 1522 predicates. 1523 1524 -- Function: -elem-index (elem list) 1525 Return the index of the first element in the given LIST which is 1526 equal to the query element ELEM, or nil if there is no such 1527 element. 1528 1529 (-elem-index 2 '(6 7 8 2 3 4)) 1530 ⇒ 3 1531 (-elem-index "bar" '("foo" "bar" "baz")) 1532 ⇒ 1 1533 (-elem-index '(1 2) '((3) (5 6) (1 2) nil)) 1534 ⇒ 2 1535 1536 -- Function: -elem-indices (elem list) 1537 Return the indices of all elements in LIST equal to the query 1538 element ELEM, in ascending order. 1539 1540 (-elem-indices 2 '(6 7 8 2 3 4 2 1)) 1541 ⇒ (3 6) 1542 (-elem-indices "bar" '("foo" "bar" "baz")) 1543 ⇒ (1) 1544 (-elem-indices '(1 2) '((3) (1 2) (5 6) (1 2) nil)) 1545 ⇒ (1 3) 1546 1547 -- Function: -find-index (pred list) 1548 Take a predicate PRED and a LIST and return the index of the first 1549 element in the list satisfying the predicate, or nil if there is no 1550 such element. 1551 1552 See also ‘-first’ (*note -first::). 1553 1554 (-find-index 'even? '(2 4 1 6 3 3 5 8)) 1555 ⇒ 0 1556 (--find-index (< 5 it) '(2 4 1 6 3 3 5 8)) 1557 ⇒ 3 1558 (-find-index (-partial 'string-lessp "baz") '("bar" "foo" "baz")) 1559 ⇒ 1 1560 1561 -- Function: -find-last-index (pred list) 1562 Take a predicate PRED and a LIST and return the index of the last 1563 element in the list satisfying the predicate, or nil if there is no 1564 such element. 1565 1566 See also ‘-last’ (*note -last::). 1567 1568 (-find-last-index 'even? '(2 4 1 6 3 3 5 8)) 1569 ⇒ 7 1570 (--find-last-index (< 5 it) '(2 7 1 6 3 8 5 2)) 1571 ⇒ 5 1572 (-find-last-index (-partial 'string-lessp "baz") '("q" "foo" "baz")) 1573 ⇒ 1 1574 1575 -- Function: -find-indices (pred list) 1576 Return the indices of all elements in LIST satisfying the predicate 1577 PRED, in ascending order. 1578 1579 (-find-indices 'even? '(2 4 1 6 3 3 5 8)) 1580 ⇒ (0 1 3 7) 1581 (--find-indices (< 5 it) '(2 4 1 6 3 3 5 8)) 1582 ⇒ (3 7) 1583 (-find-indices (-partial 'string-lessp "baz") '("bar" "foo" "baz")) 1584 ⇒ (1) 1585 1586 -- Function: -grade-up (comparator list) 1587 Grade elements of LIST using COMPARATOR relation. This yields a 1588 permutation vector such that applying this permutation to LIST 1589 sorts it in ascending order. 1590 1591 (-grade-up #'< '(3 1 4 2 1 3 3)) 1592 ⇒ (1 4 3 0 5 6 2) 1593 (let ((l '(3 1 4 2 1 3 3))) (-select-by-indices (-grade-up #'< l) l)) 1594 ⇒ (1 1 2 3 3 3 4) 1595 1596 -- Function: -grade-down (comparator list) 1597 Grade elements of LIST using COMPARATOR relation. This yields a 1598 permutation vector such that applying this permutation to LIST 1599 sorts it in descending order. 1600 1601 (-grade-down #'< '(3 1 4 2 1 3 3)) 1602 ⇒ (2 0 5 6 3 1 4) 1603 (let ((l '(3 1 4 2 1 3 3))) (-select-by-indices (-grade-down #'< l) l)) 1604 ⇒ (4 3 3 3 2 1 1) 1605 1606 1607 File: dash.info, Node: Set operations, Next: Other list operations, Prev: Indexing, Up: Functions 1608 1609 2.9 Set operations 1610 ================== 1611 1612 Operations pretending lists are sets. 1613 1614 -- Function: -union (list list2) 1615 Return a new list containing the elements of LIST and elements of 1616 LIST2 that are not in LIST. The test for equality is done with 1617 ‘equal’, or with ‘-compare-fn’ if that’s non-nil. 1618 1619 (-union '(1 2 3) '(3 4 5)) 1620 ⇒ (1 2 3 4 5) 1621 (-union '(1 2 3 4) ()) 1622 ⇒ (1 2 3 4) 1623 (-union '(1 1 2 2) '(3 2 1)) 1624 ⇒ (1 1 2 2 3) 1625 1626 -- Function: -difference (list list2) 1627 Return a new list with only the members of LIST that are not in 1628 LIST2. The test for equality is done with ‘equal’, or with 1629 ‘-compare-fn’ if that’s non-nil. 1630 1631 (-difference () ()) 1632 ⇒ () 1633 (-difference '(1 2 3) '(4 5 6)) 1634 ⇒ (1 2 3) 1635 (-difference '(1 2 3 4) '(3 4 5 6)) 1636 ⇒ (1 2) 1637 1638 -- Function: -intersection (list list2) 1639 Return a new list containing only the elements that are members of 1640 both LIST and LIST2. The test for equality is done with ‘equal’, 1641 or with ‘-compare-fn’ if that’s non-nil. 1642 1643 (-intersection () ()) 1644 ⇒ () 1645 (-intersection '(1 2 3) '(4 5 6)) 1646 ⇒ () 1647 (-intersection '(1 2 3 4) '(3 4 5 6)) 1648 ⇒ (3 4) 1649 1650 -- Function: -powerset (list) 1651 Return the power set of LIST. 1652 1653 (-powerset ()) 1654 ⇒ (nil) 1655 (-powerset '(x y z)) 1656 ⇒ ((x y z) (x y) (x z) (x) (y z) (y) (z) nil) 1657 1658 -- Function: -permutations (list) 1659 Return the permutations of LIST. 1660 1661 (-permutations ()) 1662 ⇒ (nil) 1663 (-permutations '(1 2)) 1664 ⇒ ((1 2) (2 1)) 1665 (-permutations '(a b c)) 1666 ⇒ ((a b c) (a c b) (b a c) (b c a) (c a b) (c b a)) 1667 1668 -- Function: -distinct (list) 1669 Return a new list with all duplicates removed. The test for 1670 equality is done with ‘equal’, or with ‘-compare-fn’ if that’s 1671 non-nil. 1672 1673 Alias: ‘-uniq’ 1674 1675 (-distinct ()) 1676 ⇒ () 1677 (-distinct '(1 2 2 4)) 1678 ⇒ (1 2 4) 1679 (-distinct '(t t t)) 1680 ⇒ (t) 1681 1682 1683 File: dash.info, Node: Other list operations, Next: Tree operations, Prev: Set operations, Up: Functions 1684 1685 2.10 Other list operations 1686 ========================== 1687 1688 Other list functions not fit to be classified elsewhere. 1689 1690 -- Function: -rotate (n list) 1691 Rotate LIST N places to the right (left if N is negative). The 1692 time complexity is O(n). 1693 1694 (-rotate 3 '(1 2 3 4 5 6 7)) 1695 ⇒ (5 6 7 1 2 3 4) 1696 (-rotate -3 '(1 2 3 4 5 6 7)) 1697 ⇒ (4 5 6 7 1 2 3) 1698 (-rotate 16 '(1 2 3 4 5 6 7)) 1699 ⇒ (6 7 1 2 3 4 5) 1700 1701 -- Function: -repeat (n x) 1702 Return a new list of length N with each element being X. Return 1703 nil if N is less than 1. 1704 1705 (-repeat 3 :a) 1706 ⇒ (:a :a :a) 1707 (-repeat 1 :a) 1708 ⇒ (:a) 1709 (-repeat 0 :a) 1710 ⇒ nil 1711 1712 -- Function: -cons* (&rest args) 1713 Make a new list from the elements of ARGS. The last 2 elements of 1714 ARGS are used as the final cons of the result, so if the final 1715 element of ARGS is not a list, the result is a dotted list. With 1716 no ARGS, return nil. 1717 1718 (-cons* 1 2) 1719 ⇒ (1 . 2) 1720 (-cons* 1 2 3) 1721 ⇒ (1 2 . 3) 1722 (-cons* 1) 1723 ⇒ 1 1724 1725 -- Function: -snoc (list elem &rest elements) 1726 Append ELEM to the end of the list. 1727 1728 This is like ‘cons’, but operates on the end of list. 1729 1730 If ELEMENTS is non nil, append these to the list as well. 1731 1732 (-snoc '(1 2 3) 4) 1733 ⇒ (1 2 3 4) 1734 (-snoc '(1 2 3) 4 5 6) 1735 ⇒ (1 2 3 4 5 6) 1736 (-snoc '(1 2 3) '(4 5 6)) 1737 ⇒ (1 2 3 (4 5 6)) 1738 1739 -- Function: -interpose (sep list) 1740 Return a new list of all elements in LIST separated by SEP. 1741 1742 (-interpose "-" ()) 1743 ⇒ () 1744 (-interpose "-" '("a")) 1745 ⇒ ("a") 1746 (-interpose "-" '("a" "b" "c")) 1747 ⇒ ("a" "-" "b" "-" "c") 1748 1749 -- Function: -interleave (&rest lists) 1750 Return a new list of the first item in each list, then the second 1751 etc. 1752 1753 (-interleave '(1 2) '("a" "b")) 1754 ⇒ (1 "a" 2 "b") 1755 (-interleave '(1 2) '("a" "b") '("A" "B")) 1756 ⇒ (1 "a" "A" 2 "b" "B") 1757 (-interleave '(1 2 3) '("a" "b")) 1758 ⇒ (1 "a" 2 "b") 1759 1760 -- Function: -iota (count &optional start step) 1761 Return a list containing COUNT numbers. Starts from START and adds 1762 STEP each time. The default START is zero, the default STEP is 1. 1763 This function takes its name from the corresponding primitive in 1764 the APL language. 1765 1766 (-iota 6) 1767 ⇒ (0 1 2 3 4 5) 1768 (-iota 4 2.5 -2) 1769 ⇒ (2.5 0.5 -1.5 -3.5) 1770 (-iota -1) 1771 error→ Wrong type argument: natnump, -1 1772 1773 -- Function: -zip-with (fn list1 list2) 1774 Zip the two lists LIST1 and LIST2 using a function FN. This 1775 function is applied pairwise taking as first argument element of 1776 LIST1 and as second argument element of LIST2 at corresponding 1777 position. 1778 1779 The anaphoric form ‘--zip-with’ binds the elements from LIST1 as 1780 symbol ‘it’, and the elements from LIST2 as symbol ‘other’. 1781 1782 (-zip-with '+ '(1 2 3) '(4 5 6)) 1783 ⇒ (5 7 9) 1784 (-zip-with 'cons '(1 2 3) '(4 5 6)) 1785 ⇒ ((1 . 4) (2 . 5) (3 . 6)) 1786 (--zip-with (concat it " and " other) '("Batman" "Jekyll") '("Robin" "Hyde")) 1787 ⇒ ("Batman and Robin" "Jekyll and Hyde") 1788 1789 -- Function: -zip (&rest lists) 1790 Zip LISTS together. Group the head of each list, followed by the 1791 second elements of each list, and so on. The lengths of the 1792 returned groupings are equal to the length of the shortest input 1793 list. 1794 1795 If two lists are provided as arguments, return the groupings as a 1796 list of cons cells. Otherwise, return the groupings as a list of 1797 lists. 1798 1799 Use ‘-zip-lists’ (*note -zip-lists::) if you need the return value 1800 to always be a list of lists. 1801 1802 Alias: ‘-zip-pair’ 1803 1804 See also: ‘-zip-lists’ (*note -zip-lists::) 1805 1806 (-zip '(1 2 3) '(4 5 6)) 1807 ⇒ ((1 . 4) (2 . 5) (3 . 6)) 1808 (-zip '(1 2 3) '(4 5 6 7)) 1809 ⇒ ((1 . 4) (2 . 5) (3 . 6)) 1810 (-zip '(1 2) '(3 4 5) '(6)) 1811 ⇒ ((1 3 6)) 1812 1813 -- Function: -zip-lists (&rest lists) 1814 Zip LISTS together. Group the head of each list, followed by the 1815 second elements of each list, and so on. The lengths of the 1816 returned groupings are equal to the length of the shortest input 1817 list. 1818 1819 The return value is always list of lists, which is a difference 1820 from ‘-zip-pair’ which returns a cons-cell in case two input lists 1821 are provided. 1822 1823 See also: ‘-zip’ (*note -zip::) 1824 1825 (-zip-lists '(1 2 3) '(4 5 6)) 1826 ⇒ ((1 4) (2 5) (3 6)) 1827 (-zip-lists '(1 2 3) '(4 5 6 7)) 1828 ⇒ ((1 4) (2 5) (3 6)) 1829 (-zip-lists '(1 2) '(3 4 5) '(6)) 1830 ⇒ ((1 3 6)) 1831 1832 -- Function: -zip-fill (fill-value &rest lists) 1833 Zip LISTS, with FILL-VALUE padded onto the shorter lists. The 1834 lengths of the returned groupings are equal to the length of the 1835 longest input list. 1836 1837 (-zip-fill 0 '(1 2 3 4 5) '(6 7 8 9)) 1838 ⇒ ((1 . 6) (2 . 7) (3 . 8) (4 . 9) (5 . 0)) 1839 1840 -- Function: -unzip (lists) 1841 Unzip LISTS. 1842 1843 This works just like ‘-zip’ (*note -zip::) but takes a list of 1844 lists instead of a variable number of arguments, such that 1845 1846 (-unzip (-zip L1 L2 L3 ...)) 1847 1848 is identity (given that the lists are the same length). 1849 1850 Note in particular that calling this on a list of two lists will 1851 return a list of cons-cells such that the above identity works. 1852 1853 See also: ‘-zip’ (*note -zip::) 1854 1855 (-unzip (-zip '(1 2 3) '(a b c) '("e" "f" "g"))) 1856 ⇒ ((1 2 3) (a b c) ("e" "f" "g")) 1857 (-unzip '((1 2) (3 4) (5 6) (7 8) (9 10))) 1858 ⇒ ((1 3 5 7 9) (2 4 6 8 10)) 1859 (-unzip '((1 2) (3 4))) 1860 ⇒ ((1 . 3) (2 . 4)) 1861 1862 -- Function: -cycle (list) 1863 Return an infinite circular copy of LIST. The returned list cycles 1864 through the elements of LIST and repeats from the beginning. 1865 1866 (-take 5 (-cycle '(1 2 3))) 1867 ⇒ (1 2 3 1 2) 1868 (-take 7 (-cycle '(1 "and" 3))) 1869 ⇒ (1 "and" 3 1 "and" 3 1) 1870 (-zip (-cycle '(1 2 3)) '(1 2)) 1871 ⇒ ((1 . 1) (2 . 2)) 1872 1873 -- Function: -pad (fill-value &rest lists) 1874 Appends FILL-VALUE to the end of each list in LISTS such that they 1875 will all have the same length. 1876 1877 (-pad 0 ()) 1878 ⇒ (nil) 1879 (-pad 0 '(1)) 1880 ⇒ ((1)) 1881 (-pad 0 '(1 2 3) '(4 5)) 1882 ⇒ ((1 2 3) (4 5 0)) 1883 1884 -- Function: -table (fn &rest lists) 1885 Compute outer product of LISTS using function FN. 1886 1887 The function FN should have the same arity as the number of 1888 supplied lists. 1889 1890 The outer product is computed by applying fn to all possible 1891 combinations created by taking one element from each list in order. 1892 The dimension of the result is (length lists). 1893 1894 See also: ‘-table-flat’ (*note -table-flat::) 1895 1896 (-table '* '(1 2 3) '(1 2 3)) 1897 ⇒ ((1 2 3) (2 4 6) (3 6 9)) 1898 (-table (lambda (a b) (-sum (-zip-with '* a b))) '((1 2) (3 4)) '((1 3) (2 4))) 1899 ⇒ ((7 15) (10 22)) 1900 (apply '-table 'list (-repeat 3 '(1 2))) 1901 ⇒ ((((1 1 1) (2 1 1)) ((1 2 1) (2 2 1))) (((1 1 2) (2 1 2)) ((1 2 2) (2 2 2)))) 1902 1903 -- Function: -table-flat (fn &rest lists) 1904 Compute flat outer product of LISTS using function FN. 1905 1906 The function FN should have the same arity as the number of 1907 supplied lists. 1908 1909 The outer product is computed by applying fn to all possible 1910 combinations created by taking one element from each list in order. 1911 The results are flattened, ignoring the tensor structure of the 1912 result. This is equivalent to calling: 1913 1914 (-flatten-n (1- (length lists)) (apply ’-table fn lists)) 1915 1916 but the implementation here is much more efficient. 1917 1918 See also: ‘-flatten-n’ (*note -flatten-n::), ‘-table’ (*note 1919 -table::) 1920 1921 (-table-flat 'list '(1 2 3) '(a b c)) 1922 ⇒ ((1 a) (2 a) (3 a) (1 b) (2 b) (3 b) (1 c) (2 c) (3 c)) 1923 (-table-flat '* '(1 2 3) '(1 2 3)) 1924 ⇒ (1 2 3 2 4 6 3 6 9) 1925 (apply '-table-flat 'list (-repeat 3 '(1 2))) 1926 ⇒ ((1 1 1) (2 1 1) (1 2 1) (2 2 1) (1 1 2) (2 1 2) (1 2 2) (2 2 2)) 1927 1928 -- Function: -first (pred list) 1929 Return the first item in LIST for which PRED returns non-nil. 1930 Return nil if no such element is found. To get the first item in 1931 the list no questions asked, use ‘car’. 1932 1933 Alias: ‘-find’. 1934 1935 This function’s anaphoric counterpart is ‘--first’. 1936 1937 (-first #'natnump '(-1 0 1)) 1938 ⇒ 0 1939 (-first #'null '(1 2 3)) 1940 ⇒ nil 1941 (--first (> it 2) '(1 2 3)) 1942 ⇒ 3 1943 1944 -- Function: -last (pred list) 1945 Return the last x in LIST where (PRED x) is non-nil, else nil. 1946 1947 (-last 'even? '(1 2 3 4 5 6 3 3 3)) 1948 ⇒ 6 1949 (-last 'even? '(1 3 7 5 9)) 1950 ⇒ nil 1951 (--last (> (length it) 3) '("a" "looong" "word" "and" "short" "one")) 1952 ⇒ "short" 1953 1954 -- Function: -first-item (list) 1955 Return the first item of LIST, or nil on an empty list. 1956 1957 See also: ‘-second-item’ (*note -second-item::), ‘-last-item’ 1958 (*note -last-item::). 1959 1960 (-first-item '(1 2 3)) 1961 ⇒ 1 1962 (-first-item nil) 1963 ⇒ nil 1964 (let ((list (list 1 2 3))) (setf (-first-item list) 5) list) 1965 ⇒ (5 2 3) 1966 1967 -- Function: -second-item (list) 1968 Return the second item of LIST, or nil if LIST is too short. 1969 1970 See also: ‘-third-item’ (*note -third-item::). 1971 1972 (-second-item '(1 2 3)) 1973 ⇒ 2 1974 (-second-item nil) 1975 ⇒ nil 1976 1977 -- Function: -third-item (list) 1978 Return the third item of LIST, or nil if LIST is too short. 1979 1980 See also: ‘-fourth-item’ (*note -fourth-item::). 1981 1982 (-third-item '(1 2 3)) 1983 ⇒ 3 1984 (-third-item nil) 1985 ⇒ nil 1986 1987 -- Function: -fourth-item (list) 1988 Return the fourth item of LIST, or nil if LIST is too short. 1989 1990 See also: ‘-fifth-item’ (*note -fifth-item::). 1991 1992 (-fourth-item '(1 2 3 4)) 1993 ⇒ 4 1994 (-fourth-item nil) 1995 ⇒ nil 1996 1997 -- Function: -fifth-item (list) 1998 Return the fifth item of LIST, or nil if LIST is too short. 1999 2000 See also: ‘-last-item’ (*note -last-item::). 2001 2002 (-fifth-item '(1 2 3 4 5)) 2003 ⇒ 5 2004 (-fifth-item nil) 2005 ⇒ nil 2006 2007 -- Function: -last-item (list) 2008 Return the last item of LIST, or nil on an empty list. 2009 2010 (-last-item '(1 2 3)) 2011 ⇒ 3 2012 (-last-item nil) 2013 ⇒ nil 2014 (let ((list (list 1 2 3))) (setf (-last-item list) 5) list) 2015 ⇒ (1 2 5) 2016 2017 -- Function: -butlast (list) 2018 Return a list of all items in list except for the last. 2019 2020 (-butlast '(1 2 3)) 2021 ⇒ (1 2) 2022 (-butlast '(1 2)) 2023 ⇒ (1) 2024 (-butlast '(1)) 2025 ⇒ nil 2026 2027 -- Function: -sort (comparator list) 2028 Sort LIST, stably, comparing elements using COMPARATOR. Return the 2029 sorted list. LIST is NOT modified by side effects. COMPARATOR is 2030 called with two elements of LIST, and should return non-nil if the 2031 first element should sort before the second. 2032 2033 (-sort '< '(3 1 2)) 2034 ⇒ (1 2 3) 2035 (-sort '> '(3 1 2)) 2036 ⇒ (3 2 1) 2037 (--sort (< it other) '(3 1 2)) 2038 ⇒ (1 2 3) 2039 2040 -- Function: -list (arg) 2041 Ensure ARG is a list. If ARG is already a list, return it as is 2042 (not a copy). Otherwise, return a new list with ARG as its only 2043 element. 2044 2045 Another supported calling convention is (-list &rest ARGS). In 2046 this case, if ARG is not a list, a new list with all of ARGS as 2047 elements is returned. This use is supported for backward 2048 compatibility and is otherwise deprecated. 2049 2050 (-list 1) 2051 ⇒ (1) 2052 (-list ()) 2053 ⇒ () 2054 (-list '(1 2 3)) 2055 ⇒ (1 2 3) 2056 2057 -- Function: -fix (fn list) 2058 Compute the (least) fixpoint of FN with initial input LIST. 2059 2060 FN is called at least once, results are compared with ‘equal’. 2061 2062 (-fix (lambda (l) (-non-nil (--mapcat (-split-at (/ (length it) 2) it) l))) '((1 2 3))) 2063 ⇒ ((1) (2) (3)) 2064 (let ((l '((starwars scifi) (jedi starwars warrior)))) (--fix (-uniq (--mapcat (cons it (cdr (assq it l))) it)) '(jedi book))) 2065 ⇒ (jedi starwars warrior scifi book) 2066 2067 2068 File: dash.info, Node: Tree operations, Next: Threading macros, Prev: Other list operations, Up: Functions 2069 2070 2.11 Tree operations 2071 ==================== 2072 2073 Functions pretending lists are trees. 2074 2075 -- Function: -tree-seq (branch children tree) 2076 Return a sequence of the nodes in TREE, in depth-first search 2077 order. 2078 2079 BRANCH is a predicate of one argument that returns non-nil if the 2080 passed argument is a branch, that is, a node that can have 2081 children. 2082 2083 CHILDREN is a function of one argument that returns the children of 2084 the passed branch node. 2085 2086 Non-branch nodes are simply copied. 2087 2088 (-tree-seq 'listp 'identity '(1 (2 3) 4 (5 (6 7)))) 2089 ⇒ ((1 (2 3) 4 (5 (6 7))) 1 (2 3) 2 3 4 (5 (6 7)) 5 (6 7) 6 7) 2090 (-tree-seq 'listp 'reverse '(1 (2 3) 4 (5 (6 7)))) 2091 ⇒ ((1 (2 3) 4 (5 (6 7))) (5 (6 7)) (6 7) 7 6 5 4 (2 3) 3 2 1) 2092 (--tree-seq (vectorp it) (append it nil) [1 [2 3] 4 [5 [6 7]]]) 2093 ⇒ ([1 [2 3] 4 [5 [6 7]]] 1 [2 3] 2 3 4 [5 [6 7]] 5 [6 7] 6 7) 2094 2095 -- Function: -tree-map (fn tree) 2096 Apply FN to each element of TREE while preserving the tree 2097 structure. 2098 2099 (-tree-map '1+ '(1 (2 3) (4 (5 6) 7))) 2100 ⇒ (2 (3 4) (5 (6 7) 8)) 2101 (-tree-map '(lambda (x) (cons x (expt 2 x))) '(1 (2 3) 4)) 2102 ⇒ ((1 . 2) ((2 . 4) (3 . 8)) (4 . 16)) 2103 (--tree-map (length it) '("<body>" ("<p>" "text" "</p>") "</body>")) 2104 ⇒ (6 (3 4 4) 7) 2105 2106 -- Function: -tree-map-nodes (pred fun tree) 2107 Call FUN on each node of TREE that satisfies PRED. 2108 2109 If PRED returns nil, continue descending down this node. If PRED 2110 returns non-nil, apply FUN to this node and do not descend further. 2111 2112 (-tree-map-nodes 'vectorp (lambda (x) (-sum (append x nil))) '(1 [2 3] 4 (5 [6 7] 8))) 2113 ⇒ (1 5 4 (5 13 8)) 2114 (-tree-map-nodes 'keywordp (lambda (x) (symbol-name x)) '(1 :foo 4 ((5 6 :bar) :baz 8))) 2115 ⇒ (1 ":foo" 4 ((5 6 ":bar") ":baz" 8)) 2116 (--tree-map-nodes (eq (car-safe it) 'add-mode) (-concat it (list :mode 'emacs-lisp-mode)) '(with-mode emacs-lisp-mode (foo bar) (add-mode a b) (baz (add-mode c d)))) 2117 ⇒ (with-mode emacs-lisp-mode (foo bar) (add-mode a b :mode emacs-lisp-mode) (baz (add-mode c d :mode emacs-lisp-mode))) 2118 2119 -- Function: -tree-reduce (fn tree) 2120 Use FN to reduce elements of list TREE. If elements of TREE are 2121 lists themselves, apply the reduction recursively. 2122 2123 FN is first applied to first element of the list and second 2124 element, then on this result and third element from the list etc. 2125 2126 See ‘-reduce-r’ (*note -reduce-r::) for how exactly are lists of 2127 zero or one element handled. 2128 2129 (-tree-reduce '+ '(1 (2 3) (4 5))) 2130 ⇒ 15 2131 (-tree-reduce 'concat '("strings" (" on" " various") ((" levels")))) 2132 ⇒ "strings on various levels" 2133 (--tree-reduce (cond ((stringp it) (concat it " " acc)) (t (let ((sn (symbol-name it))) (concat "<" sn ">" acc "</" sn ">")))) '(body (p "some words") (div "more" (b "bold") "words"))) 2134 ⇒ "<body><p>some words</p> <div>more <b>bold</b> words</div></body>" 2135 2136 -- Function: -tree-reduce-from (fn init-value tree) 2137 Use FN to reduce elements of list TREE. If elements of TREE are 2138 lists themselves, apply the reduction recursively. 2139 2140 FN is first applied to INIT-VALUE and first element of the list, 2141 then on this result and second element from the list etc. 2142 2143 The initial value is ignored on cons pairs as they always contain 2144 two elements. 2145 2146 (-tree-reduce-from '+ 1 '(1 (1 1) ((1)))) 2147 ⇒ 8 2148 (--tree-reduce-from (-concat acc (list it)) nil '(1 (2 3 (4 5)) (6 7))) 2149 ⇒ ((7 6) ((5 4) 3 2) 1) 2150 2151 -- Function: -tree-mapreduce (fn folder tree) 2152 Apply FN to each element of TREE, and make a list of the results. 2153 If elements of TREE are lists themselves, apply FN recursively to 2154 elements of these nested lists. 2155 2156 Then reduce the resulting lists using FOLDER and initial value 2157 INIT-VALUE. See ‘-reduce-r-from’ (*note -reduce-r-from::). 2158 2159 This is the same as calling ‘-tree-reduce’ (*note -tree-reduce::) 2160 after ‘-tree-map’ (*note -tree-map::) but is twice as fast as it 2161 only traverse the structure once. 2162 2163 (-tree-mapreduce 'list 'append '(1 (2 (3 4) (5 6)) (7 (8 9)))) 2164 ⇒ (1 2 3 4 5 6 7 8 9) 2165 (--tree-mapreduce 1 (+ it acc) '(1 (2 (4 9) (2 1)) (7 (4 3)))) 2166 ⇒ 9 2167 (--tree-mapreduce 0 (max acc (1+ it)) '(1 (2 (4 9) (2 1)) (7 (4 3)))) 2168 ⇒ 3 2169 2170 -- Function: -tree-mapreduce-from (fn folder init-value tree) 2171 Apply FN to each element of TREE, and make a list of the results. 2172 If elements of TREE are lists themselves, apply FN recursively to 2173 elements of these nested lists. 2174 2175 Then reduce the resulting lists using FOLDER and initial value 2176 INIT-VALUE. See ‘-reduce-r-from’ (*note -reduce-r-from::). 2177 2178 This is the same as calling ‘-tree-reduce-from’ (*note 2179 -tree-reduce-from::) after ‘-tree-map’ (*note -tree-map::) but is 2180 twice as fast as it only traverse the structure once. 2181 2182 (-tree-mapreduce-from 'identity '* 1 '(1 (2 (3 4) (5 6)) (7 (8 9)))) 2183 ⇒ 362880 2184 (--tree-mapreduce-from (+ it it) (cons it acc) nil '(1 (2 (4 9) (2 1)) (7 (4 3)))) 2185 ⇒ (2 (4 (8 18) (4 2)) (14 (8 6))) 2186 (concat "{" (--tree-mapreduce-from (cond ((-cons-pair? it) (concat (symbol-name (car it)) " -> " (symbol-name (cdr it)))) (t (concat (symbol-name it) " : {"))) (concat it (unless (or (equal acc "}") (equal (substring it (1- (length it))) "{")) ", ") acc) "}" '((elisp-mode (foo (bar . booze)) (baz . qux)) (c-mode (foo . bla) (bum . bam))))) 2187 ⇒ "{elisp-mode : {foo : {bar -> booze}, baz -> qux}, c-mode : {foo -> bla, bum -> bam}}" 2188 2189 -- Function: -clone (list) 2190 Create a deep copy of LIST. The new list has the same elements and 2191 structure but all cons are replaced with new ones. This is useful 2192 when you need to clone a structure such as plist or alist. 2193 2194 (let* ((a '(1 2 3)) (b (-clone a))) (nreverse a) b) 2195 ⇒ (1 2 3) 2196 2197 2198 File: dash.info, Node: Threading macros, Next: Binding, Prev: Tree operations, Up: Functions 2199 2200 2.12 Threading macros 2201 ===================== 2202 2203 Macros that conditionally combine sequential forms for brevity or 2204 readability. 2205 2206 -- Macro: -> (x &optional form &rest more) 2207 Thread the expr through the forms. Insert X as the second item in 2208 the first form, making a list of it if it is not a list already. 2209 If there are more forms, insert the first form as the second item 2210 in second form, etc. 2211 2212 (-> '(2 3 5)) 2213 ⇒ (2 3 5) 2214 (-> '(2 3 5) (append '(8 13))) 2215 ⇒ (2 3 5 8 13) 2216 (-> '(2 3 5) (append '(8 13)) (-slice 1 -1)) 2217 ⇒ (3 5 8) 2218 2219 -- Macro: ->> (x &optional form &rest more) 2220 Thread the expr through the forms. Insert X as the last item in 2221 the first form, making a list of it if it is not a list already. 2222 If there are more forms, insert the first form as the last item in 2223 second form, etc. 2224 2225 (->> '(1 2 3) (-map 'square)) 2226 ⇒ (1 4 9) 2227 (->> '(1 2 3) (-map 'square) (-remove 'even?)) 2228 ⇒ (1 9) 2229 (->> '(1 2 3) (-map 'square) (-reduce '+)) 2230 ⇒ 14 2231 2232 -- Macro: --> (x &rest forms) 2233 Starting with the value of X, thread each expression through FORMS. 2234 2235 Insert X at the position signified by the symbol ‘it’ in the first 2236 form. If there are more forms, insert the first form at the 2237 position signified by ‘it’ in in second form, etc. 2238 2239 (--> "def" (concat "abc" it "ghi")) 2240 ⇒ "abcdefghi" 2241 (--> "def" (concat "abc" it "ghi") (upcase it)) 2242 ⇒ "ABCDEFGHI" 2243 (--> "def" (concat "abc" it "ghi") upcase) 2244 ⇒ "ABCDEFGHI" 2245 2246 -- Macro: -as-> (value variable &rest forms) 2247 Starting with VALUE, thread VARIABLE through FORMS. 2248 2249 In the first form, bind VARIABLE to VALUE. In the second form, 2250 bind VARIABLE to the result of the first form, and so forth. 2251 2252 (-as-> 3 my-var (1+ my-var) (list my-var) (mapcar (lambda (ele) (* 2 ele)) my-var)) 2253 ⇒ (8) 2254 (-as-> 3 my-var 1+) 2255 ⇒ 4 2256 (-as-> 3 my-var) 2257 ⇒ 3 2258 2259 -- Macro: -some-> (x &optional form &rest more) 2260 When expr is non-nil, thread it through the first form (via ‘->’ 2261 (*note ->::)), and when that result is non-nil, through the next 2262 form, etc. 2263 2264 (-some-> '(2 3 5)) 2265 ⇒ (2 3 5) 2266 (-some-> 5 square) 2267 ⇒ 25 2268 (-some-> 5 even? square) 2269 ⇒ nil 2270 2271 -- Macro: -some->> (x &optional form &rest more) 2272 When expr is non-nil, thread it through the first form (via ‘->>’ 2273 (*note ->>::)), and when that result is non-nil, through the next 2274 form, etc. 2275 2276 (-some->> '(1 2 3) (-map 'square)) 2277 ⇒ (1 4 9) 2278 (-some->> '(1 3 5) (-last 'even?) (+ 100)) 2279 ⇒ nil 2280 (-some->> '(2 4 6) (-last 'even?) (+ 100)) 2281 ⇒ 106 2282 2283 -- Macro: -some--> (expr &rest forms) 2284 Thread EXPR through FORMS via ‘-->’ (*note -->::), while the result 2285 is non-nil. When EXPR evaluates to non-nil, thread the result 2286 through the first of FORMS, and when that result is non-nil, thread 2287 it through the next form, etc. 2288 2289 (-some--> "def" (concat "abc" it "ghi")) 2290 ⇒ "abcdefghi" 2291 (-some--> nil (concat "abc" it "ghi")) 2292 ⇒ nil 2293 (-some--> '(0 1) (-remove #'natnump it) (append it it) (-map #'1+ it)) 2294 ⇒ () 2295 2296 -- Macro: -doto (init &rest forms) 2297 Evaluate INIT and pass it as argument to FORMS with ‘->’ (*note 2298 ->::). The RESULT of evaluating INIT is threaded through each of 2299 FORMS individually using ‘->’ (*note ->::), which see. The return 2300 value is RESULT, which FORMS may have modified by side effect. 2301 2302 (-doto (list 1 2 3) pop pop) 2303 ⇒ (3) 2304 (-doto (cons 1 2) (setcar 3) (setcdr 4)) 2305 ⇒ (3 . 4) 2306 (gethash 'k (--doto (make-hash-table) (puthash 'k 'v it))) 2307 ⇒ v 2308 2309 2310 File: dash.info, Node: Binding, Next: Side effects, Prev: Threading macros, Up: Functions 2311 2312 2.13 Binding 2313 ============ 2314 2315 Macros that combine ‘let’ and ‘let*’ with destructuring and flow 2316 control. 2317 2318 -- Macro: -when-let ((var val) &rest body) 2319 If VAL evaluates to non-nil, bind it to VAR and execute body. 2320 2321 Note: binding is done according to ‘-let’ (*note -let::). 2322 2323 (-when-let (match-index (string-match "d" "abcd")) (+ match-index 2)) 2324 ⇒ 5 2325 (-when-let ((&plist :foo foo) (list :foo "foo")) foo) 2326 ⇒ "foo" 2327 (-when-let ((&plist :foo foo) (list :bar "bar")) foo) 2328 ⇒ nil 2329 2330 -- Macro: -when-let* (vars-vals &rest body) 2331 If all VALS evaluate to true, bind them to their corresponding VARS 2332 and execute body. VARS-VALS should be a list of (VAR VAL) pairs. 2333 2334 Note: binding is done according to ‘-let*’ (*note -let*::). VALS 2335 are evaluated sequentially, and evaluation stops after the first 2336 nil VAL is encountered. 2337 2338 (-when-let* ((x 5) (y 3) (z (+ y 4))) (+ x y z)) 2339 ⇒ 15 2340 (-when-let* ((x 5) (y nil) (z 7)) (+ x y z)) 2341 ⇒ nil 2342 2343 -- Macro: -if-let ((var val) then &rest else) 2344 If VAL evaluates to non-nil, bind it to VAR and do THEN, otherwise 2345 do ELSE. 2346 2347 Note: binding is done according to ‘-let’ (*note -let::). 2348 2349 (-if-let (match-index (string-match "d" "abc")) (+ match-index 3) 7) 2350 ⇒ 7 2351 (--if-let (even? 4) it nil) 2352 ⇒ t 2353 2354 -- Macro: -if-let* (vars-vals then &rest else) 2355 If all VALS evaluate to true, bind them to their corresponding VARS 2356 and do THEN, otherwise do ELSE. VARS-VALS should be a list of (VAR 2357 VAL) pairs. 2358 2359 Note: binding is done according to ‘-let*’ (*note -let*::). VALS 2360 are evaluated sequentially, and evaluation stops after the first 2361 nil VAL is encountered. 2362 2363 (-if-let* ((x 5) (y 3) (z 7)) (+ x y z) "foo") 2364 ⇒ 15 2365 (-if-let* ((x 5) (y nil) (z 7)) (+ x y z) "foo") 2366 ⇒ "foo" 2367 (-if-let* (((_ _ x) '(nil nil 7))) x) 2368 ⇒ 7 2369 2370 -- Macro: -let (varlist &rest body) 2371 Bind variables according to VARLIST then eval BODY. 2372 2373 VARLIST is a list of lists of the form (PATTERN SOURCE). Each 2374 PATTERN is matched against the SOURCE "structurally". SOURCE is 2375 only evaluated once for each PATTERN. Each PATTERN is matched 2376 recursively, and can therefore contain sub-patterns which are 2377 matched against corresponding sub-expressions of SOURCE. 2378 2379 All the SOURCEs are evalled before any symbols are bound (i.e. "in 2380 parallel"). 2381 2382 If VARLIST only contains one (PATTERN SOURCE) element, you can 2383 optionally specify it using a vector and discarding the outer-most 2384 parens. Thus 2385 2386 (-let ((PATTERN SOURCE)) ...) 2387 2388 becomes 2389 2390 (-let [PATTERN SOURCE] ...). 2391 2392 ‘-let’ (*note -let::) uses a convention of not binding places 2393 (symbols) starting with _ whenever it’s possible. You can use this 2394 to skip over entries you don’t care about. However, this is not 2395 *always* possible (as a result of implementation) and these symbols 2396 might get bound to undefined values. 2397 2398 Following is the overview of supported patterns. Remember that 2399 patterns can be matched recursively, so every a, b, aK in the 2400 following can be a matching construct and not necessarily a 2401 symbol/variable. 2402 2403 Symbol: 2404 2405 a - bind the SOURCE to A. This is just like regular ‘let’. 2406 2407 Conses and lists: 2408 2409 (a) - bind ‘car’ of cons/list to A 2410 2411 (a . b) - bind car of cons to A and ‘cdr’ to B 2412 2413 (a b) - bind car of list to A and ‘cadr’ to B 2414 2415 (a1 a2 a3 ...) - bind 0th car of list to A1, 1st to A2, 2nd to 2416 A3... 2417 2418 (a1 a2 a3 ... aN . rest) - as above, but bind the Nth cdr to REST. 2419 2420 Vectors: 2421 2422 [a] - bind 0th element of a non-list sequence to A (works with 2423 vectors, strings, bit arrays...) 2424 2425 [a1 a2 a3 ...] - bind 0th element of non-list sequence to A0, 1st 2426 to A1, 2nd to A2, ... If the PATTERN is shorter than SOURCE, the 2427 values at places not in PATTERN are ignored. If the PATTERN is 2428 longer than SOURCE, an ‘error’ is thrown. 2429 2430 [a1 a2 a3 ... &rest rest] - as above, but bind the rest of the 2431 sequence to REST. This is conceptually the same as improper list 2432 matching (a1 a2 ... aN . rest) 2433 2434 Key/value stores: 2435 2436 (&plist key0 a0 ... keyN aN) - bind value mapped by keyK in the 2437 SOURCE plist to aK. If the value is not found, aK is nil. Uses 2438 ‘plist-get’ to fetch values. 2439 2440 (&alist key0 a0 ... keyN aN) - bind value mapped by keyK in the 2441 SOURCE alist to aK. If the value is not found, aK is nil. Uses 2442 ‘assoc’ to fetch values. 2443 2444 (&hash key0 a0 ... keyN aN) - bind value mapped by keyK in the 2445 SOURCE hash table to aK. If the value is not found, aK is nil. 2446 Uses ‘gethash’ to fetch values. 2447 2448 Further, special keyword &keys supports "inline" matching of 2449 plist-like key-value pairs, similarly to &keys keyword of 2450 ‘cl-defun’. 2451 2452 (a1 a2 ... aN &keys key1 b1 ... keyN bK) 2453 2454 This binds N values from the list to a1 ... aN, then interprets the 2455 cdr as a plist (see key/value matching above). 2456 2457 A shorthand notation for kv-destructuring exists which allows the 2458 patterns be optionally left out and derived from the key name in 2459 the following fashion: 2460 2461 - a key :foo is converted into ‘foo’ pattern, - a key ’bar is 2462 converted into ‘bar’ pattern, - a key "baz" is converted into ‘baz’ 2463 pattern. 2464 2465 That is, the entire value under the key is bound to the derived 2466 variable without any further destructuring. 2467 2468 This is possible only when the form following the key is not a 2469 valid pattern (i.e. not a symbol, a cons cell or a vector). 2470 Otherwise the matching proceeds as usual and in case of an invalid 2471 spec fails with an error. 2472 2473 Thus the patterns are normalized as follows: 2474 2475 ;; derive all the missing patterns (&plist :foo ’bar "baz") => 2476 (&plist :foo foo ’bar bar "baz" baz) 2477 2478 ;; we can specify some but not others (&plist :foo ’bar 2479 explicit-bar) => (&plist :foo foo ’bar explicit-bar) 2480 2481 ;; nothing happens, we store :foo in x (&plist :foo x) => (&plist 2482 :foo x) 2483 2484 ;; nothing happens, we match recursively (&plist :foo (a b c)) => 2485 (&plist :foo (a b c)) 2486 2487 You can name the source using the syntax SYMBOL &as PATTERN. This 2488 syntax works with lists (proper or improper), vectors and all types 2489 of maps. 2490 2491 (list &as a b c) (list 1 2 3) 2492 2493 binds A to 1, B to 2, C to 3 and LIST to (1 2 3). 2494 2495 Similarly: 2496 2497 (bounds &as beg . end) (cons 1 2) 2498 2499 binds BEG to 1, END to 2 and BOUNDS to (1 . 2). 2500 2501 (items &as first . rest) (list 1 2 3) 2502 2503 binds FIRST to 1, REST to (2 3) and ITEMS to (1 2 3) 2504 2505 [vect &as _ b c] [1 2 3] 2506 2507 binds B to 2, C to 3 and VECT to [1 2 3] (_ avoids binding as 2508 usual). 2509 2510 (plist &as &plist :b b) (list :a 1 :b 2 :c 3) 2511 2512 binds B to 2 and PLIST to (:a 1 :b 2 :c 3). Same for &alist and 2513 &hash. 2514 2515 This is especially useful when we want to capture the result of a 2516 computation and destructure at the same time. Consider the form 2517 (function-returning-complex-structure) returning a list of two 2518 vectors with two items each. We want to capture this entire result 2519 and pass it to another computation, but at the same time we want to 2520 get the second item from each vector. We can achieve it with 2521 pattern 2522 2523 (result &as [_ a] [_ b]) (function-returning-complex-structure) 2524 2525 Note: Clojure programmers may know this feature as the ":as 2526 binding". The difference is that we put the &as at the front 2527 because we need to support improper list binding. 2528 2529 (-let (([a (b c) d] [1 (2 3) 4])) (list a b c d)) 2530 ⇒ (1 2 3 4) 2531 (-let [(a b c . d) (list 1 2 3 4 5 6)] (list a b c d)) 2532 ⇒ (1 2 3 (4 5 6)) 2533 (-let [(&plist :foo foo :bar bar) (list :baz 3 :foo 1 :qux 4 :bar 2)] (list foo bar)) 2534 ⇒ (1 2) 2535 2536 -- Macro: -let* (varlist &rest body) 2537 Bind variables according to VARLIST then eval BODY. 2538 2539 VARLIST is a list of lists of the form (PATTERN SOURCE). Each 2540 PATTERN is matched against the SOURCE structurally. SOURCE is only 2541 evaluated once for each PATTERN. 2542 2543 Each SOURCE can refer to the symbols already bound by this VARLIST. 2544 This is useful if you want to destructure SOURCE recursively but 2545 also want to name the intermediate structures. 2546 2547 See ‘-let’ (*note -let::) for the list of all possible patterns. 2548 2549 (-let* (((a . b) (cons 1 2)) ((c . d) (cons 3 4))) (list a b c d)) 2550 ⇒ (1 2 3 4) 2551 (-let* (((a . b) (cons 1 (cons 2 3))) ((c . d) b)) (list a b c d)) 2552 ⇒ (1 (2 . 3) 2 3) 2553 (-let* (((&alist "foo" foo "bar" bar) (list (cons "foo" 1) (cons "bar" (list 'a 'b 'c)))) ((a b c) bar)) (list foo a b c bar)) 2554 ⇒ (1 a b c (a b c)) 2555 2556 -- Macro: -lambda (match-form &rest body) 2557 Return a lambda which destructures its input as MATCH-FORM and 2558 executes BODY. 2559 2560 Note that you have to enclose the MATCH-FORM in a pair of parens, 2561 such that: 2562 2563 (-lambda (x) body) (-lambda (x y ...) body) 2564 2565 has the usual semantics of ‘lambda’. Furthermore, these get 2566 translated into normal ‘lambda’, so there is no performance 2567 penalty. 2568 2569 See ‘-let’ (*note -let::) for a description of the destructuring 2570 mechanism. 2571 2572 (-map (-lambda ((x y)) (+ x y)) '((1 2) (3 4) (5 6))) 2573 ⇒ (3 7 11) 2574 (-map (-lambda ([x y]) (+ x y)) '([1 2] [3 4] [5 6])) 2575 ⇒ (3 7 11) 2576 (funcall (-lambda ((_ . a) (_ . b)) (-concat a b)) '(1 2 3) '(4 5 6)) 2577 ⇒ (2 3 5 6) 2578 2579 -- Macro: -setq ([match-form val] ...) 2580 Bind each MATCH-FORM to the value of its VAL. 2581 2582 MATCH-FORM destructuring is done according to the rules of ‘-let’ 2583 (*note -let::). 2584 2585 This macro allows you to bind multiple variables by destructuring 2586 the value, so for example: 2587 2588 (-setq (a b) x (&plist :c c) plist) 2589 2590 expands roughly speaking to the following code 2591 2592 (setq a (car x) b (cadr x) c (plist-get plist :c)) 2593 2594 Care is taken to only evaluate each VAL once so that in case of 2595 multiple assignments it does not cause unexpected side effects. 2596 2597 (let (a) (-setq a 1) a) 2598 ⇒ 1 2599 (let (a b) (-setq (a b) (list 1 2)) (list a b)) 2600 ⇒ (1 2) 2601 (let (c) (-setq (&plist :c c) (list :c "c")) c) 2602 ⇒ "c" 2603 2604 2605 File: dash.info, Node: Side effects, Next: Destructive operations, Prev: Binding, Up: Functions 2606 2607 2.14 Side effects 2608 ================= 2609 2610 Functions iterating over lists for side effect only. 2611 2612 -- Function: -each (list fn) 2613 Call FN on each element of LIST. Return nil; this function is 2614 intended for side effects. 2615 2616 Its anaphoric counterpart is ‘--each’. 2617 2618 For access to the current element’s index in LIST, see 2619 ‘-each-indexed’ (*note -each-indexed::). 2620 2621 (let (l) (-each '(1 2 3) (lambda (x) (push x l))) l) 2622 ⇒ (3 2 1) 2623 (let (l) (--each '(1 2 3) (push it l)) l) 2624 ⇒ (3 2 1) 2625 (-each '(1 2 3) #'identity) 2626 ⇒ nil 2627 2628 -- Function: -each-while (list pred fn) 2629 Call FN on each ITEM in LIST, while (PRED ITEM) is non-nil. Once 2630 an ITEM is reached for which PRED returns nil, FN is no longer 2631 called. Return nil; this function is intended for side effects. 2632 2633 Its anaphoric counterpart is ‘--each-while’. 2634 2635 (let (l) (-each-while '(2 4 5 6) #'even? (lambda (x) (push x l))) l) 2636 ⇒ (4 2) 2637 (let (l) (--each-while '(1 2 3 4) (< it 3) (push it l)) l) 2638 ⇒ (2 1) 2639 (let ((s 0)) (--each-while '(1 3 4 5) (< it 5) (setq s (+ s it))) s) 2640 ⇒ 8 2641 2642 -- Function: -each-indexed (list fn) 2643 Call FN on each index and element of LIST. For each ITEM at INDEX 2644 in LIST, call (funcall FN INDEX ITEM). Return nil; this function 2645 is intended for side effects. 2646 2647 See also: ‘-map-indexed’ (*note -map-indexed::). 2648 2649 (let (l) (-each-indexed '(a b c) (lambda (i x) (push (list x i) l))) l) 2650 ⇒ ((c 2) (b 1) (a 0)) 2651 (let (l) (--each-indexed '(a b c) (push (list it it-index) l)) l) 2652 ⇒ ((c 2) (b 1) (a 0)) 2653 (let (l) (--each-indexed () (push it l)) l) 2654 ⇒ () 2655 2656 -- Function: -each-r (list fn) 2657 Call FN on each element of LIST in reversed order. Return nil; 2658 this function is intended for side effects. 2659 2660 Its anaphoric counterpart is ‘--each-r’. 2661 2662 (let (l) (-each-r '(1 2 3) (lambda (x) (push x l))) l) 2663 ⇒ (1 2 3) 2664 (let (l) (--each-r '(1 2 3) (push it l)) l) 2665 ⇒ (1 2 3) 2666 (-each-r '(1 2 3) #'identity) 2667 ⇒ nil 2668 2669 -- Function: -each-r-while (list pred fn) 2670 Call FN on each ITEM in reversed LIST, while (PRED ITEM) is 2671 non-nil. Once an ITEM is reached for which PRED returns nil, FN is 2672 no longer called. Return nil; this function is intended for side 2673 effects. 2674 2675 Its anaphoric counterpart is ‘--each-r-while’. 2676 2677 (let (l) (-each-r-while '(2 4 5 6) #'even? (lambda (x) (push x l))) l) 2678 ⇒ (6) 2679 (let (l) (--each-r-while '(1 2 3 4) (>= it 3) (push it l)) l) 2680 ⇒ (3 4) 2681 (let ((s 0)) (--each-r-while '(1 2 3 5) (> it 1) (setq s (+ s it))) s) 2682 ⇒ 10 2683 2684 -- Function: -dotimes (num fn) 2685 Call FN NUM times, presumably for side effects. FN is called with 2686 a single argument on successive integers running from 0, inclusive, 2687 to NUM, exclusive. FN is not called if NUM is less than 1. 2688 2689 This function’s anaphoric counterpart is ‘--dotimes’. 2690 2691 (let (s) (-dotimes 3 (lambda (n) (push n s))) s) 2692 ⇒ (2 1 0) 2693 (let (s) (-dotimes 0 (lambda (n) (push n s))) s) 2694 ⇒ () 2695 (let (s) (--dotimes 5 (push it s)) s) 2696 ⇒ (4 3 2 1 0) 2697 2698 2699 File: dash.info, Node: Destructive operations, Next: Function combinators, Prev: Side effects, Up: Functions 2700 2701 2.15 Destructive operations 2702 =========================== 2703 2704 Macros that modify variables holding lists. 2705 2706 -- Macro: !cons (car cdr) 2707 Destructive: Set CDR to the cons of CAR and CDR. 2708 2709 (let (l) (!cons 5 l) l) 2710 ⇒ (5) 2711 (let ((l '(3))) (!cons 5 l) l) 2712 ⇒ (5 3) 2713 2714 -- Macro: !cdr (list) 2715 Destructive: Set LIST to the cdr of LIST. 2716 2717 (let ((l '(3))) (!cdr l) l) 2718 ⇒ () 2719 (let ((l '(3 5))) (!cdr l) l) 2720 ⇒ (5) 2721 2722 2723 File: dash.info, Node: Function combinators, Prev: Destructive operations, Up: Functions 2724 2725 2.16 Function combinators 2726 ========================= 2727 2728 Functions that manipulate and compose other functions. 2729 2730 -- Function: -partial (fun &rest args) 2731 Return a function that is a partial application of FUN to ARGS. 2732 ARGS is a list of the first N arguments to pass to FUN. The result 2733 is a new function which does the same as FUN, except that the first 2734 N arguments are fixed at the values with which this function was 2735 called. 2736 2737 (funcall (-partial #'+ 5)) 2738 ⇒ 5 2739 (funcall (-partial #'- 5) 3) 2740 ⇒ 2 2741 (funcall (-partial #'+ 5 2) 3) 2742 ⇒ 10 2743 2744 -- Function: -rpartial (fn &rest args) 2745 Return a function that is a partial application of FN to ARGS. 2746 ARGS is a list of the last N arguments to pass to FN. The result 2747 is a new function which does the same as FN, except that the last N 2748 arguments are fixed at the values with which this function was 2749 called. This is like ‘-partial’ (*note -partial::), except the 2750 arguments are fixed starting from the right rather than the left. 2751 2752 (funcall (-rpartial #'- 5)) 2753 ⇒ -5 2754 (funcall (-rpartial #'- 5) 8) 2755 ⇒ 3 2756 (funcall (-rpartial #'- 5 2) 10) 2757 ⇒ 3 2758 2759 -- Function: -juxt (&rest fns) 2760 Return a function that is the juxtaposition of FNS. The returned 2761 function takes a variable number of ARGS, applies each of FNS in 2762 turn to ARGS, and returns the list of results. 2763 2764 (funcall (-juxt) 1 2) 2765 ⇒ () 2766 (funcall (-juxt #'+ #'- #'* #'/) 7 5) 2767 ⇒ (12 2 35 1) 2768 (mapcar (-juxt #'number-to-string #'1+) '(1 2)) 2769 ⇒ (("1" 2) ("2" 3)) 2770 2771 -- Function: -compose (&rest fns) 2772 Compose FNS into a single composite function. Return a function 2773 that takes a variable number of ARGS, applies the last function in 2774 FNS to ARGS, and returns the result of calling each remaining 2775 function on the result of the previous function, right-to-left. If 2776 no FNS are given, return a variadic ‘identity’ function. 2777 2778 (funcall (-compose #'- #'1+ #'+) 1 2 3) 2779 ⇒ -7 2780 (funcall (-compose #'identity #'1+) 3) 2781 ⇒ 4 2782 (mapcar (-compose #'not #'stringp) '(nil "")) 2783 ⇒ (t nil) 2784 2785 -- Function: -applify (fn) 2786 Return a function that applies FN to a single list of args. This 2787 changes the arity of FN from taking N distinct arguments to taking 2788 1 argument which is a list of N arguments. 2789 2790 (funcall (-applify #'+) nil) 2791 ⇒ 0 2792 (mapcar (-applify #'+) '((1 1 1) (1 2 3) (5 5 5))) 2793 ⇒ (3 6 15) 2794 (funcall (-applify #'<) '(3 6)) 2795 ⇒ t 2796 2797 -- Function: -on (op trans) 2798 Return a function that calls TRANS on each arg and OP on the 2799 results. The returned function takes a variable number of 2800 arguments, calls the function TRANS on each one in turn, and then 2801 passes those results as the list of arguments to OP, in the same 2802 order. 2803 2804 For example, the following pairs of expressions are morally 2805 equivalent: 2806 2807 (funcall (-on #’+ #’1+) 1 2 3) = (+ (1+ 1) (1+ 2) (1+ 3)) (funcall 2808 (-on #’+ #’1+)) = (+) 2809 2810 (-sort (-on #'< #'length) '((1 2 3) (1) (1 2))) 2811 ⇒ ((1) (1 2) (1 2 3)) 2812 (funcall (-on #'min #'string-to-number) "22" "2" "1" "12") 2813 ⇒ 1 2814 (-min-by (-on #'> #'length) '((1 2 3) (4) (1 2))) 2815 ⇒ (4) 2816 2817 -- Function: -flip (fn) 2818 Return a function that calls FN with its arguments reversed. The 2819 returned function takes the same number of arguments as FN. 2820 2821 For example, the following two expressions are morally equivalent: 2822 2823 (funcall (-flip #’-) 1 2) = (- 2 1) 2824 2825 See also: ‘-rotate-args’ (*note -rotate-args::). 2826 2827 (-sort (-flip #'<) '(4 3 6 1)) 2828 ⇒ (6 4 3 1) 2829 (funcall (-flip #'-) 3 2 1 10) 2830 ⇒ 4 2831 (funcall (-flip #'1+) 1) 2832 ⇒ 2 2833 2834 -- Function: -rotate-args (n fn) 2835 Return a function that calls FN with args rotated N places to the 2836 right. The returned function takes the same number of arguments as 2837 FN, rotates the list of arguments N places to the right (left if N 2838 is negative) just like ‘-rotate’ (*note -rotate::), and applies FN 2839 to the result. 2840 2841 See also: ‘-flip’ (*note -flip::). 2842 2843 (funcall (-rotate-args -1 #'list) 1 2 3 4) 2844 ⇒ (2 3 4 1) 2845 (funcall (-rotate-args 1 #'-) 1 10 100) 2846 ⇒ 89 2847 (funcall (-rotate-args 2 #'list) 3 4 5 1 2) 2848 ⇒ (1 2 3 4 5) 2849 2850 -- Function: -const (c) 2851 Return a function that returns C ignoring any additional arguments. 2852 2853 In types: a -> b -> a 2854 2855 (funcall (-const 2) 1 3 "foo") 2856 ⇒ 2 2857 (mapcar (-const 1) '("a" "b" "c" "d")) 2858 ⇒ (1 1 1 1) 2859 (-sum (mapcar (-const 1) '("a" "b" "c" "d"))) 2860 ⇒ 4 2861 2862 -- Macro: -cut (&rest params) 2863 Take n-ary function and n arguments and specialize some of them. 2864 Arguments denoted by <> will be left unspecialized. 2865 2866 See SRFI-26 for detailed description. 2867 2868 (funcall (-cut list 1 <> 3 <> 5) 2 4) 2869 ⇒ (1 2 3 4 5) 2870 (-map (-cut funcall <> 5) `(1+ 1- ,(lambda (x) (/ 1.0 x)))) 2871 ⇒ (6 4 0.2) 2872 (-map (-cut <> 1 2 3) '(list vector string)) 2873 ⇒ ((1 2 3) [1 2 3] "\1\2\3") 2874 2875 -- Function: -not (pred) 2876 Return a predicate that negates the result of PRED. The returned 2877 predicate passes its arguments to PRED. If PRED returns nil, the 2878 result is non-nil; otherwise the result is nil. 2879 2880 See also: ‘-andfn’ (*note -andfn::) and ‘-orfn’ (*note -orfn::). 2881 2882 (funcall (-not #'numberp) "5") 2883 ⇒ t 2884 (-sort (-not #'<) '(5 2 1 0 6)) 2885 ⇒ (6 5 2 1 0) 2886 (-filter (-not (-partial #'< 4)) '(1 2 3 4 5 6 7 8)) 2887 ⇒ (1 2 3 4) 2888 2889 -- Function: -orfn (&rest preds) 2890 Return a predicate that returns the first non-nil result of PREDS. 2891 The returned predicate takes a variable number of arguments, passes 2892 them to each predicate in PREDS in turn until one of them returns 2893 non-nil, and returns that non-nil result without calling the 2894 remaining PREDS. If all PREDS return nil, or if no PREDS are 2895 given, the returned predicate returns nil. 2896 2897 See also: ‘-andfn’ (*note -andfn::) and ‘-not’ (*note -not::). 2898 2899 (-filter (-orfn #'natnump #'booleanp) '(1 nil "a" -4 b c t)) 2900 ⇒ (1 nil t) 2901 (funcall (-orfn #'symbolp (-cut string-match-p "x" <>)) "axe") 2902 ⇒ 1 2903 (funcall (-orfn #'= #'+) 1 1) 2904 ⇒ t 2905 2906 -- Function: -andfn (&rest preds) 2907 Return a predicate that returns non-nil if all PREDS do so. The 2908 returned predicate P takes a variable number of arguments and 2909 passes them to each predicate in PREDS in turn. If any one of 2910 PREDS returns nil, P also returns nil without calling the remaining 2911 PREDS. If all PREDS return non-nil, P returns the last such value. 2912 If no PREDS are given, P always returns non-nil. 2913 2914 See also: ‘-orfn’ (*note -orfn::) and ‘-not’ (*note -not::). 2915 2916 (-filter (-andfn #'numberp (-cut < <> 5)) '(a 1 b 6 c 2)) 2917 ⇒ (1 2) 2918 (mapcar (-andfn #'numberp #'1+) '(a 1 b 6)) 2919 ⇒ (nil 2 nil 7) 2920 (funcall (-andfn #'= #'+) 1 1) 2921 ⇒ 2 2922 2923 -- Function: -iteratefn (fn n) 2924 Return a function FN composed N times with itself. 2925 2926 FN is a unary function. If you need to use a function of higher 2927 arity, use ‘-applify’ (*note -applify::) first to turn it into a 2928 unary function. 2929 2930 With n = 0, this acts as identity function. 2931 2932 In types: (a -> a) -> Int -> a -> a. 2933 2934 This function satisfies the following law: 2935 2936 (funcall (-iteratefn fn n) init) = (-last-item (-iterate fn init 2937 (1+ n))). 2938 2939 (funcall (-iteratefn (lambda (x) (* x x)) 3) 2) 2940 ⇒ 256 2941 (funcall (-iteratefn '1+ 3) 1) 2942 ⇒ 4 2943 (funcall (-iteratefn 'cdr 3) '(1 2 3 4 5)) 2944 ⇒ (4 5) 2945 2946 -- Function: -fixfn (fn &optional equal-test halt-test) 2947 Return a function that computes the (least) fixpoint of FN. 2948 2949 FN must be a unary function. The returned lambda takes a single 2950 argument, X, the initial value for the fixpoint iteration. The 2951 iteration halts when either of the following conditions is 2952 satisfied: 2953 2954 1. Iteration converges to the fixpoint, with equality being tested 2955 using EQUAL-TEST. If EQUAL-TEST is not specified, ‘equal’ is used. 2956 For functions over the floating point numbers, it may be necessary 2957 to provide an appropriate approximate comparison test. 2958 2959 2. HALT-TEST returns a non-nil value. HALT-TEST defaults to a 2960 simple counter that returns t after ‘-fixfn-max-iterations’, to 2961 guard against infinite iteration. Otherwise, HALT-TEST must be a 2962 function that accepts a single argument, the current value of X, 2963 and returns non-nil as long as iteration should continue. In this 2964 way, a more sophisticated convergence test may be supplied by the 2965 caller. 2966 2967 The return value of the lambda is either the fixpoint or, if 2968 iteration halted before converging, a cons with car ‘halted’ and 2969 cdr the final output from HALT-TEST. 2970 2971 In types: (a -> a) -> a -> a. 2972 2973 (funcall (-fixfn #'cos #'approx=) 0.7) 2974 ⇒ 0.7390851332151607 2975 (funcall (-fixfn (lambda (x) (expt (+ x 10) 0.25))) 2.0) 2976 ⇒ 1.8555845286409378 2977 (funcall (-fixfn #'sin #'approx=) 0.1) 2978 ⇒ (halted . t) 2979 2980 -- Function: -prodfn (&rest fns) 2981 Take a list of n functions and return a function that takes a list 2982 of length n, applying i-th function to i-th element of the input 2983 list. Returns a list of length n. 2984 2985 In types (for n=2): ((a -> b), (c -> d)) -> (a, c) -> (b, d) 2986 2987 This function satisfies the following laws: 2988 2989 (-compose (-prodfn f g ...) (-prodfn f’ g’ ...)) = (-prodfn 2990 (-compose f f’) (-compose g g’) ...) (-prodfn f g ...) = (-juxt 2991 (-compose f (-partial ’nth 0)) (-compose g (-partial ’nth 1)) ...) 2992 (-compose (-prodfn f g ...) (-juxt f’ g’ ...)) = (-juxt (-compose f 2993 f’) (-compose g g’) ...) (-compose (-partial ’nth n) (-prod f1 f2 2994 ...)) = (-compose fn (-partial ’nth n)) 2995 2996 (funcall (-prodfn '1+ '1- 'number-to-string) '(1 2 3)) 2997 ⇒ (2 1 "3") 2998 (-map (-prodfn '1+ '1-) '((1 2) (3 4) (5 6) (7 8))) 2999 ⇒ ((2 1) (4 3) (6 5) (8 7)) 3000 (apply '+ (funcall (-prodfn 'length 'string-to-number) '((1 2 3) "15"))) 3001 ⇒ 18 3002 3003 3004 File: dash.info, Node: Development, Next: FDL, Prev: Functions, Up: Top 3005 3006 3 Development 3007 ************* 3008 3009 The Dash repository is hosted on GitHub at 3010 <https://github.com/magnars/dash.el>. 3011 3012 * Menu: 3013 3014 * Contribute:: How to contribute. 3015 * Contributors:: List of contributors. 3016 3017 3018 File: dash.info, Node: Contribute, Next: Contributors, Up: Development 3019 3020 3.1 Contribute 3021 ============== 3022 3023 Yes, please do. Pure functions in the list manipulation realm only, 3024 please. There’s a suite of examples/tests in ‘dev/examples.el’, so 3025 remember to add tests for your additions, or they may get broken later. 3026 3027 Run the tests with ‘make check’. Regenerate the docs with ‘make 3028 docs’. Contributors are encouraged to install these commands as a Git 3029 pre-commit hook, so that the tests are always running and the docs are 3030 always in sync: 3031 3032 $ cp dev/pre-commit.sh .git/hooks/pre-commit 3033 3034 Oh, and don’t edit ‘README.md’ or ‘dash.texi’ directly, as they are 3035 auto-generated. Instead, change their respective templates 3036 ‘readme-template.md’ or ‘dash-template.texi’. 3037 3038 To ensure that Dash can be distributed with GNU ELPA or Emacs, we 3039 require that all contributors assign copyright to the Free Software 3040 Foundation. For more on this, *note (emacs)Copyright Assignment::. 3041 3042 3043 File: dash.info, Node: Contributors, Prev: Contribute, Up: Development 3044 3045 3.2 Contributors 3046 ================ 3047 3048 • Matus Goljer (https://github.com/Fuco1) contributed lots of 3049 features and functions. 3050 • Takafumi Arakaki (https://github.com/tkf) contributed ‘-group-by’. 3051 • tali713 (https://github.com/tali713) is the author of ‘-applify’. 3052 • Víctor M. Valenzuela (https://github.com/vemv) contributed 3053 ‘-repeat’. 3054 • Nic Ferrier (https://github.com/nicferrier) contributed ‘-cons*’. 3055 • Wilfred Hughes (https://github.com/Wilfred) contributed ‘-slice’, 3056 ‘-first-item’, and ‘-last-item’. 3057 • Emanuel Evans (https://github.com/shosti) contributed ‘-if-let’, 3058 ‘-when-let’, and ‘-insert-at’. 3059 • Johan Andersson (https://github.com/rejeep) contributed ‘-sum’, 3060 ‘-product’, and ‘-same-items?’. 3061 • Christina Whyte (https://github.com/kurisuwhyte) contributed 3062 ‘-compose’. 3063 • Steve Lamb (https://github.com/steventlamb) contributed ‘-cycle’, 3064 ‘-pad’, ‘-annotate’, ‘-zip-fill’, and a variadic version of ‘-zip’. 3065 • Fredrik Bergroth (https://github.com/fbergroth) made the ‘-if-let’ 3066 family use ‘-let’ destructuring and improved the script for 3067 generating documentation. 3068 • Mark Oteiza (https://github.com/holomorph) contributed ‘-iota’ and 3069 the script to create an Info manual. 3070 • Vasilij Schneidermann (https://github.com/wasamasa) contributed 3071 ‘-some’. 3072 • William West (https://github.com/occidens) made ‘-fixfn’ more 3073 robust at handling floats. 3074 • Cam Saul (https://github.com/camsaul) contributed ‘-some->’, 3075 ‘-some->>’, and ‘-some-->’. 3076 • Basil L. Contovounesios (https://github.com/basil-conto) 3077 contributed ‘-common-prefix’, ‘-common-suffix’, and various other 3078 improvements. 3079 • Paul Pogonyshev (https://github.com/doublep) contributed ‘-each-r’ 3080 and ‘-each-r-while’. 3081 3082 Thanks! 3083 3084 New contributors are very welcome. *Note Contribute::. 3085 3086 3087 File: dash.info, Node: FDL, Next: GPL, Prev: Development, Up: Top 3088 3089 Appendix A GNU Free Documentation License 3090 ***************************************** 3091 3092 Version 1.3, 3 November 2008 3093 3094 Copyright © 2000, 2001, 2002, 2007, 2008 Free Software Foundation, Inc. 3095 <https://fsf.org/> 3096 3097 Everyone is permitted to copy and distribute verbatim copies 3098 of this license document, but changing it is not allowed. 3099 3100 0. PREAMBLE 3101 3102 The purpose of this License is to make a manual, textbook, or other 3103 functional and useful document “free” in the sense of freedom: to 3104 assure everyone the effective freedom to copy and redistribute it, 3105 with or without modifying it, either commercially or 3106 noncommercially. Secondarily, this License preserves for the 3107 author and publisher a way to get credit for their work, while not 3108 being considered responsible for modifications made by others. 3109 3110 This License is a kind of “copyleft”, which means that derivative 3111 works of the document must themselves be free in the same sense. 3112 It complements the GNU General Public License, which is a copyleft 3113 license designed for free software. 3114 3115 We have designed this License in order to use it for manuals for 3116 free software, because free software needs free documentation: a 3117 free program should come with manuals providing the same freedoms 3118 that the software does. But this License is not limited to 3119 software manuals; it can be used for any textual work, regardless 3120 of subject matter or whether it is published as a printed book. We 3121 recommend this License principally for works whose purpose is 3122 instruction or reference. 3123 3124 1. APPLICABILITY AND DEFINITIONS 3125 3126 This License applies to any manual or other work, in any medium, 3127 that contains a notice placed by the copyright holder saying it can 3128 be distributed under the terms of this License. Such a notice 3129 grants a world-wide, royalty-free license, unlimited in duration, 3130 to use that work under the conditions stated herein. The 3131 “Document”, below, refers to any such manual or work. Any member 3132 of the public is a licensee, and is addressed as “you”. You accept 3133 the license if you copy, modify or distribute the work in a way 3134 requiring permission under copyright law. 3135 3136 A “Modified Version” of the Document means any work containing the 3137 Document or a portion of it, either copied verbatim, or with 3138 modifications and/or translated into another language. 3139 3140 A “Secondary Section” is a named appendix or a front-matter section 3141 of the Document that deals exclusively with the relationship of the 3142 publishers or authors of the Document to the Document’s overall 3143 subject (or to related matters) and contains nothing that could 3144 fall directly within that overall subject. (Thus, if the Document 3145 is in part a textbook of mathematics, a Secondary Section may not 3146 explain any mathematics.) The relationship could be a matter of 3147 historical connection with the subject or with related matters, or 3148 of legal, commercial, philosophical, ethical or political position 3149 regarding them. 3150 3151 The “Invariant Sections” are certain Secondary Sections whose 3152 titles are designated, as being those of Invariant Sections, in the 3153 notice that says that the Document is released under this License. 3154 If a section does not fit the above definition of Secondary then it 3155 is not allowed to be designated as Invariant. The Document may 3156 contain zero Invariant Sections. If the Document does not identify 3157 any Invariant Sections then there are none. 3158 3159 The “Cover Texts” are certain short passages of text that are 3160 listed, as Front-Cover Texts or Back-Cover Texts, in the notice 3161 that says that the Document is released under this License. A 3162 Front-Cover Text may be at most 5 words, and a Back-Cover Text may 3163 be at most 25 words. 3164 3165 A “Transparent” copy of the Document means a machine-readable copy, 3166 represented in a format whose specification is available to the 3167 general public, that is suitable for revising the document 3168 straightforwardly with generic text editors or (for images composed 3169 of pixels) generic paint programs or (for drawings) some widely 3170 available drawing editor, and that is suitable for input to text 3171 formatters or for automatic translation to a variety of formats 3172 suitable for input to text formatters. A copy made in an otherwise 3173 Transparent file format whose markup, or absence of markup, has 3174 been arranged to thwart or discourage subsequent modification by 3175 readers is not Transparent. An image format is not Transparent if 3176 used for any substantial amount of text. A copy that is not 3177 “Transparent” is called “Opaque”. 3178 3179 Examples of suitable formats for Transparent copies include plain 3180 ASCII without markup, Texinfo input format, LaTeX input format, 3181 SGML or XML using a publicly available DTD, and standard-conforming 3182 simple HTML, PostScript or PDF designed for human modification. 3183 Examples of transparent image formats include PNG, XCF and JPG. 3184 Opaque formats include proprietary formats that can be read and 3185 edited only by proprietary word processors, SGML or XML for which 3186 the DTD and/or processing tools are not generally available, and 3187 the machine-generated HTML, PostScript or PDF produced by some word 3188 processors for output purposes only. 3189 3190 The “Title Page” means, for a printed book, the title page itself, 3191 plus such following pages as are needed to hold, legibly, the 3192 material this License requires to appear in the title page. For 3193 works in formats which do not have any title page as such, “Title 3194 Page” means the text near the most prominent appearance of the 3195 work’s title, preceding the beginning of the body of the text. 3196 3197 The “publisher” means any person or entity that distributes copies 3198 of the Document to the public. 3199 3200 A section “Entitled XYZ” means a named subunit of the Document 3201 whose title either is precisely XYZ or contains XYZ in parentheses 3202 following text that translates XYZ in another language. (Here XYZ 3203 stands for a specific section name mentioned below, such as 3204 “Acknowledgements”, “Dedications”, “Endorsements”, or “History”.) 3205 To “Preserve the Title” of such a section when you modify the 3206 Document means that it remains a section “Entitled XYZ” according 3207 to this definition. 3208 3209 The Document may include Warranty Disclaimers next to the notice 3210 which states that this License applies to the Document. These 3211 Warranty Disclaimers are considered to be included by reference in 3212 this License, but only as regards disclaiming warranties: any other 3213 implication that these Warranty Disclaimers may have is void and 3214 has no effect on the meaning of this License. 3215 3216 2. VERBATIM COPYING 3217 3218 You may copy and distribute the Document in any medium, either 3219 commercially or noncommercially, provided that this License, the 3220 copyright notices, and the license notice saying this License 3221 applies to the Document are reproduced in all copies, and that you 3222 add no other conditions whatsoever to those of this License. You 3223 may not use technical measures to obstruct or control the reading 3224 or further copying of the copies you make or distribute. However, 3225 you may accept compensation in exchange for copies. If you 3226 distribute a large enough number of copies you must also follow the 3227 conditions in section 3. 3228 3229 You may also lend copies, under the same conditions stated above, 3230 and you may publicly display copies. 3231 3232 3. COPYING IN QUANTITY 3233 3234 If you publish printed copies (or copies in media that commonly 3235 have printed covers) of the Document, numbering more than 100, and 3236 the Document’s license notice requires Cover Texts, you must 3237 enclose the copies in covers that carry, clearly and legibly, all 3238 these Cover Texts: Front-Cover Texts on the front cover, and 3239 Back-Cover Texts on the back cover. Both covers must also clearly 3240 and legibly identify you as the publisher of these copies. The 3241 front cover must present the full title with all words of the title 3242 equally prominent and visible. You may add other material on the 3243 covers in addition. Copying with changes limited to the covers, as 3244 long as they preserve the title of the Document and satisfy these 3245 conditions, can be treated as verbatim copying in other respects. 3246 3247 If the required texts for either cover are too voluminous to fit 3248 legibly, you should put the first ones listed (as many as fit 3249 reasonably) on the actual cover, and continue the rest onto 3250 adjacent pages. 3251 3252 If you publish or distribute Opaque copies of the Document 3253 numbering more than 100, you must either include a machine-readable 3254 Transparent copy along with each Opaque copy, or state in or with 3255 each Opaque copy a computer-network location from which the general 3256 network-using public has access to download using public-standard 3257 network protocols a complete Transparent copy of the Document, free 3258 of added material. If you use the latter option, you must take 3259 reasonably prudent steps, when you begin distribution of Opaque 3260 copies in quantity, to ensure that this Transparent copy will 3261 remain thus accessible at the stated location until at least one 3262 year after the last time you distribute an Opaque copy (directly or 3263 through your agents or retailers) of that edition to the public. 3264 3265 It is requested, but not required, that you contact the authors of 3266 the Document well before redistributing any large number of copies, 3267 to give them a chance to provide you with an updated version of the 3268 Document. 3269 3270 4. MODIFICATIONS 3271 3272 You may copy and distribute a Modified Version of the Document 3273 under the conditions of sections 2 and 3 above, provided that you 3274 release the Modified Version under precisely this License, with the 3275 Modified Version filling the role of the Document, thus licensing 3276 distribution and modification of the Modified Version to whoever 3277 possesses a copy of it. In addition, you must do these things in 3278 the Modified Version: 3279 3280 A. Use in the Title Page (and on the covers, if any) a title 3281 distinct from that of the Document, and from those of previous 3282 versions (which should, if there were any, be listed in the 3283 History section of the Document). You may use the same title 3284 as a previous version if the original publisher of that 3285 version gives permission. 3286 3287 B. List on the Title Page, as authors, one or more persons or 3288 entities responsible for authorship of the modifications in 3289 the Modified Version, together with at least five of the 3290 principal authors of the Document (all of its principal 3291 authors, if it has fewer than five), unless they release you 3292 from this requirement. 3293 3294 C. State on the Title page the name of the publisher of the 3295 Modified Version, as the publisher. 3296 3297 D. Preserve all the copyright notices of the Document. 3298 3299 E. Add an appropriate copyright notice for your modifications 3300 adjacent to the other copyright notices. 3301 3302 F. Include, immediately after the copyright notices, a license 3303 notice giving the public permission to use the Modified 3304 Version under the terms of this License, in the form shown in 3305 the Addendum below. 3306 3307 G. Preserve in that license notice the full lists of Invariant 3308 Sections and required Cover Texts given in the Document’s 3309 license notice. 3310 3311 H. Include an unaltered copy of this License. 3312 3313 I. Preserve the section Entitled “History”, Preserve its Title, 3314 and add to it an item stating at least the title, year, new 3315 authors, and publisher of the Modified Version as given on the 3316 Title Page. If there is no section Entitled “History” in the 3317 Document, create one stating the title, year, authors, and 3318 publisher of the Document as given on its Title Page, then add 3319 an item describing the Modified Version as stated in the 3320 previous sentence. 3321 3322 J. Preserve the network location, if any, given in the Document 3323 for public access to a Transparent copy of the Document, and 3324 likewise the network locations given in the Document for 3325 previous versions it was based on. These may be placed in the 3326 “History” section. You may omit a network location for a work 3327 that was published at least four years before the Document 3328 itself, or if the original publisher of the version it refers 3329 to gives permission. 3330 3331 K. For any section Entitled “Acknowledgements” or “Dedications”, 3332 Preserve the Title of the section, and preserve in the section 3333 all the substance and tone of each of the contributor 3334 acknowledgements and/or dedications given therein. 3335 3336 L. Preserve all the Invariant Sections of the Document, unaltered 3337 in their text and in their titles. Section numbers or the 3338 equivalent are not considered part of the section titles. 3339 3340 M. Delete any section Entitled “Endorsements”. Such a section 3341 may not be included in the Modified Version. 3342 3343 N. Do not retitle any existing section to be Entitled 3344 “Endorsements” or to conflict in title with any Invariant 3345 Section. 3346 3347 O. Preserve any Warranty Disclaimers. 3348 3349 If the Modified Version includes new front-matter sections or 3350 appendices that qualify as Secondary Sections and contain no 3351 material copied from the Document, you may at your option designate 3352 some or all of these sections as invariant. To do this, add their 3353 titles to the list of Invariant Sections in the Modified Version’s 3354 license notice. These titles must be distinct from any other 3355 section titles. 3356 3357 You may add a section Entitled “Endorsements”, provided it contains 3358 nothing but endorsements of your Modified Version by various 3359 parties—for example, statements of peer review or that the text has 3360 been approved by an organization as the authoritative definition of 3361 a standard. 3362 3363 You may add a passage of up to five words as a Front-Cover Text, 3364 and a passage of up to 25 words as a Back-Cover Text, to the end of 3365 the list of Cover Texts in the Modified Version. Only one passage 3366 of Front-Cover Text and one of Back-Cover Text may be added by (or 3367 through arrangements made by) any one entity. If the Document 3368 already includes a cover text for the same cover, previously added 3369 by you or by arrangement made by the same entity you are acting on 3370 behalf of, you may not add another; but you may replace the old 3371 one, on explicit permission from the previous publisher that added 3372 the old one. 3373 3374 The author(s) and publisher(s) of the Document do not by this 3375 License give permission to use their names for publicity for or to 3376 assert or imply endorsement of any Modified Version. 3377 3378 5. COMBINING DOCUMENTS 3379 3380 You may combine the Document with other documents released under 3381 this License, under the terms defined in section 4 above for 3382 modified versions, provided that you include in the combination all 3383 of the Invariant Sections of all of the original documents, 3384 unmodified, and list them all as Invariant Sections of your 3385 combined work in its license notice, and that you preserve all 3386 their Warranty Disclaimers. 3387 3388 The combined work need only contain one copy of this License, and 3389 multiple identical Invariant Sections may be replaced with a single 3390 copy. If there are multiple Invariant Sections with the same name 3391 but different contents, make the title of each such section unique 3392 by adding at the end of it, in parentheses, the name of the 3393 original author or publisher of that section if known, or else a 3394 unique number. Make the same adjustment to the section titles in 3395 the list of Invariant Sections in the license notice of the 3396 combined work. 3397 3398 In the combination, you must combine any sections Entitled 3399 “History” in the various original documents, forming one section 3400 Entitled “History”; likewise combine any sections Entitled 3401 “Acknowledgements”, and any sections Entitled “Dedications”. You 3402 must delete all sections Entitled “Endorsements.” 3403 3404 6. COLLECTIONS OF DOCUMENTS 3405 3406 You may make a collection consisting of the Document and other 3407 documents released under this License, and replace the individual 3408 copies of this License in the various documents with a single copy 3409 that is included in the collection, provided that you follow the 3410 rules of this License for verbatim copying of each of the documents 3411 in all other respects. 3412 3413 You may extract a single document from such a collection, and 3414 distribute it individually under this License, provided you insert 3415 a copy of this License into the extracted document, and follow this 3416 License in all other respects regarding verbatim copying of that 3417 document. 3418 3419 7. AGGREGATION WITH INDEPENDENT WORKS 3420 3421 A compilation of the Document or its derivatives with other 3422 separate and independent documents or works, in or on a volume of a 3423 storage or distribution medium, is called an “aggregate” if the 3424 copyright resulting from the compilation is not used to limit the 3425 legal rights of the compilation’s users beyond what the individual 3426 works permit. When the Document is included in an aggregate, this 3427 License does not apply to the other works in the aggregate which 3428 are not themselves derivative works of the Document. 3429 3430 If the Cover Text requirement of section 3 is applicable to these 3431 copies of the Document, then if the Document is less than one half 3432 of the entire aggregate, the Document’s Cover Texts may be placed 3433 on covers that bracket the Document within the aggregate, or the 3434 electronic equivalent of covers if the Document is in electronic 3435 form. Otherwise they must appear on printed covers that bracket 3436 the whole aggregate. 3437 3438 8. TRANSLATION 3439 3440 Translation is considered a kind of modification, so you may 3441 distribute translations of the Document under the terms of section 3442 4. Replacing Invariant Sections with translations requires special 3443 permission from their copyright holders, but you may include 3444 translations of some or all Invariant Sections in addition to the 3445 original versions of these Invariant Sections. You may include a 3446 translation of this License, and all the license notices in the 3447 Document, and any Warranty Disclaimers, provided that you also 3448 include the original English version of this License and the 3449 original versions of those notices and disclaimers. In case of a 3450 disagreement between the translation and the original version of 3451 this License or a notice or disclaimer, the original version will 3452 prevail. 3453 3454 If a section in the Document is Entitled “Acknowledgements”, 3455 “Dedications”, or “History”, the requirement (section 4) to 3456 Preserve its Title (section 1) will typically require changing the 3457 actual title. 3458 3459 9. TERMINATION 3460 3461 You may not copy, modify, sublicense, or distribute the Document 3462 except as expressly provided under this License. Any attempt 3463 otherwise to copy, modify, sublicense, or distribute it is void, 3464 and will automatically terminate your rights under this License. 3465 3466 However, if you cease all violation of this License, then your 3467 license from a particular copyright holder is reinstated (a) 3468 provisionally, unless and until the copyright holder explicitly and 3469 finally terminates your license, and (b) permanently, if the 3470 copyright holder fails to notify you of the violation by some 3471 reasonable means prior to 60 days after the cessation. 3472 3473 Moreover, your license from a particular copyright holder is 3474 reinstated permanently if the copyright holder notifies you of the 3475 violation by some reasonable means, this is the first time you have 3476 received notice of violation of this License (for any work) from 3477 that copyright holder, and you cure the violation prior to 30 days 3478 after your receipt of the notice. 3479 3480 Termination of your rights under this section does not terminate 3481 the licenses of parties who have received copies or rights from you 3482 under this License. If your rights have been terminated and not 3483 permanently reinstated, receipt of a copy of some or all of the 3484 same material does not give you any rights to use it. 3485 3486 10. FUTURE REVISIONS OF THIS LICENSE 3487 3488 The Free Software Foundation may publish new, revised versions of 3489 the GNU Free Documentation License from time to time. Such new 3490 versions will be similar in spirit to the present version, but may 3491 differ in detail to address new problems or concerns. See 3492 <https://www.gnu.org/licenses/>. 3493 3494 Each version of the License is given a distinguishing version 3495 number. If the Document specifies that a particular numbered 3496 version of this License “or any later version” applies to it, you 3497 have the option of following the terms and conditions either of 3498 that specified version or of any later version that has been 3499 published (not as a draft) by the Free Software Foundation. If the 3500 Document does not specify a version number of this License, you may 3501 choose any version ever published (not as a draft) by the Free 3502 Software Foundation. If the Document specifies that a proxy can 3503 decide which future versions of this License can be used, that 3504 proxy’s public statement of acceptance of a version permanently 3505 authorizes you to choose that version for the Document. 3506 3507 11. RELICENSING 3508 3509 “Massive Multiauthor Collaboration Site” (or “MMC Site”) means any 3510 World Wide Web server that publishes copyrightable works and also 3511 provides prominent facilities for anybody to edit those works. A 3512 public wiki that anybody can edit is an example of such a server. 3513 A “Massive Multiauthor Collaboration” (or “MMC”) contained in the 3514 site means any set of copyrightable works thus published on the MMC 3515 site. 3516 3517 “CC-BY-SA” means the Creative Commons Attribution-Share Alike 3.0 3518 license published by Creative Commons Corporation, a not-for-profit 3519 corporation with a principal place of business in San Francisco, 3520 California, as well as future copyleft versions of that license 3521 published by that same organization. 3522 3523 “Incorporate” means to publish or republish a Document, in whole or 3524 in part, as part of another Document. 3525 3526 An MMC is “eligible for relicensing” if it is licensed under this 3527 License, and if all works that were first published under this 3528 License somewhere other than this MMC, and subsequently 3529 incorporated in whole or in part into the MMC, (1) had no cover 3530 texts or invariant sections, and (2) were thus incorporated prior 3531 to November 1, 2008. 3532 3533 The operator of an MMC Site may republish an MMC contained in the 3534 site under CC-BY-SA on the same site at any time before August 1, 3535 2009, provided the MMC is eligible for relicensing. 3536 3537 ADDENDUM: How to use this License for your documents 3538 ==================================================== 3539 3540 To use this License in a document you have written, include a copy of 3541 the License in the document and put the following copyright and license 3542 notices just after the title page: 3543 3544 Copyright (C) YEAR YOUR NAME. 3545 Permission is granted to copy, distribute and/or modify this document 3546 under the terms of the GNU Free Documentation License, Version 1.3 3547 or any later version published by the Free Software Foundation; 3548 with no Invariant Sections, no Front-Cover Texts, and no Back-Cover 3549 Texts. A copy of the license is included in the section entitled ``GNU 3550 Free Documentation License''. 3551 3552 If you have Invariant Sections, Front-Cover Texts and Back-Cover 3553 Texts, replace the “with...Texts.” line with this: 3554 3555 with the Invariant Sections being LIST THEIR TITLES, with 3556 the Front-Cover Texts being LIST, and with the Back-Cover Texts 3557 being LIST. 3558 3559 If you have Invariant Sections without Cover Texts, or some other 3560 combination of the three, merge those two alternatives to suit the 3561 situation. 3562 3563 If your document contains nontrivial examples of program code, we 3564 recommend releasing these examples in parallel under your choice of free 3565 software license, such as the GNU General Public License, to permit 3566 their use in free software. 3567 3568 3569 File: dash.info, Node: GPL, Next: Index, Prev: FDL, Up: Top 3570 3571 Appendix B GNU General Public License 3572 ************************************* 3573 3574 Version 3, 29 June 2007 3575 3576 Copyright © 2007 Free Software Foundation, Inc. <https://fsf.org/> 3577 3578 Everyone is permitted to copy and distribute verbatim copies of this 3579 license document, but changing it is not allowed. 3580 3581 Preamble 3582 ======== 3583 3584 The GNU General Public License is a free, copyleft license for software 3585 and other kinds of works. 3586 3587 The licenses for most software and other practical works are designed 3588 to take away your freedom to share and change the works. By contrast, 3589 the GNU General Public License is intended to guarantee your freedom to 3590 share and change all versions of a program—to make sure it remains free 3591 software for all its users. We, the Free Software Foundation, use the 3592 GNU General Public License for most of our software; it applies also to 3593 any other work released this way by its authors. You can apply it to 3594 your programs, too. 3595 3596 When we speak of free software, we are referring to freedom, not 3597 price. Our General Public Licenses are designed to make sure that you 3598 have the freedom to distribute copies of free software (and charge for 3599 them if you wish), that you receive source code or can get it if you 3600 want it, that you can change the software or use pieces of it in new 3601 free programs, and that you know you can do these things. 3602 3603 To protect your rights, we need to prevent others from denying you 3604 these rights or asking you to surrender the rights. Therefore, you have 3605 certain responsibilities if you distribute copies of the software, or if 3606 you modify it: responsibilities to respect the freedom of others. 3607 3608 For example, if you distribute copies of such a program, whether 3609 gratis or for a fee, you must pass on to the recipients the same 3610 freedoms that you received. You must make sure that they, too, receive 3611 or can get the source code. And you must show them these terms so they 3612 know their rights. 3613 3614 Developers that use the GNU GPL protect your rights with two steps: 3615 (1) assert copyright on the software, and (2) offer you this License 3616 giving you legal permission to copy, distribute and/or modify it. 3617 3618 For the developers’ and authors’ protection, the GPL clearly explains 3619 that there is no warranty for this free software. For both users’ and 3620 authors’ sake, the GPL requires that modified versions be marked as 3621 changed, so that their problems will not be attributed erroneously to 3622 authors of previous versions. 3623 3624 Some devices are designed to deny users access to install or run 3625 modified versions of the software inside them, although the manufacturer 3626 can do so. This is fundamentally incompatible with the aim of 3627 protecting users’ freedom to change the software. The systematic 3628 pattern of such abuse occurs in the area of products for individuals to 3629 use, which is precisely where it is most unacceptable. Therefore, we 3630 have designed this version of the GPL to prohibit the practice for those 3631 products. If such problems arise substantially in other domains, we 3632 stand ready to extend this provision to those domains in future versions 3633 of the GPL, as needed to protect the freedom of users. 3634 3635 Finally, every program is threatened constantly by software patents. 3636 States should not allow patents to restrict development and use of 3637 software on general-purpose computers, but in those that do, we wish to 3638 avoid the special danger that patents applied to a free program could 3639 make it effectively proprietary. To prevent this, the GPL assures that 3640 patents cannot be used to render the program non-free. 3641 3642 The precise terms and conditions for copying, distribution and 3643 modification follow. 3644 3645 TERMS AND CONDITIONS 3646 ==================== 3647 3648 0. Definitions. 3649 3650 “This License” refers to version 3 of the GNU General Public 3651 License. 3652 3653 “Copyright” also means copyright-like laws that apply to other 3654 kinds of works, such as semiconductor masks. 3655 3656 “The Program” refers to any copyrightable work licensed under this 3657 License. Each licensee is addressed as “you”. “Licensees” and 3658 “recipients” may be individuals or organizations. 3659 3660 To “modify” a work means to copy from or adapt all or part of the 3661 work in a fashion requiring copyright permission, other than the 3662 making of an exact copy. The resulting work is called a “modified 3663 version” of the earlier work or a work “based on” the earlier work. 3664 3665 A “covered work” means either the unmodified Program or a work 3666 based on the Program. 3667 3668 To “propagate” a work means to do anything with it that, without 3669 permission, would make you directly or secondarily liable for 3670 infringement under applicable copyright law, except executing it on 3671 a computer or modifying a private copy. Propagation includes 3672 copying, distribution (with or without modification), making 3673 available to the public, and in some countries other activities as 3674 well. 3675 3676 To “convey” a work means any kind of propagation that enables other 3677 parties to make or receive copies. Mere interaction with a user 3678 through a computer network, with no transfer of a copy, is not 3679 conveying. 3680 3681 An interactive user interface displays “Appropriate Legal Notices” 3682 to the extent that it includes a convenient and prominently visible 3683 feature that (1) displays an appropriate copyright notice, and (2) 3684 tells the user that there is no warranty for the work (except to 3685 the extent that warranties are provided), that licensees may convey 3686 the work under this License, and how to view a copy of this 3687 License. If the interface presents a list of user commands or 3688 options, such as a menu, a prominent item in the list meets this 3689 criterion. 3690 3691 1. Source Code. 3692 3693 The “source code” for a work means the preferred form of the work 3694 for making modifications to it. “Object code” means any non-source 3695 form of a work. 3696 3697 A “Standard Interface” means an interface that either is an 3698 official standard defined by a recognized standards body, or, in 3699 the case of interfaces specified for a particular programming 3700 language, one that is widely used among developers working in that 3701 language. 3702 3703 The “System Libraries” of an executable work include anything, 3704 other than the work as a whole, that (a) is included in the normal 3705 form of packaging a Major Component, but which is not part of that 3706 Major Component, and (b) serves only to enable use of the work with 3707 that Major Component, or to implement a Standard Interface for 3708 which an implementation is available to the public in source code 3709 form. A “Major Component”, in this context, means a major 3710 essential component (kernel, window system, and so on) of the 3711 specific operating system (if any) on which the executable work 3712 runs, or a compiler used to produce the work, or an object code 3713 interpreter used to run it. 3714 3715 The “Corresponding Source” for a work in object code form means all 3716 the source code needed to generate, install, and (for an executable 3717 work) run the object code and to modify the work, including scripts 3718 to control those activities. However, it does not include the 3719 work’s System Libraries, or general-purpose tools or generally 3720 available free programs which are used unmodified in performing 3721 those activities but which are not part of the work. For example, 3722 Corresponding Source includes interface definition files associated 3723 with source files for the work, and the source code for shared 3724 libraries and dynamically linked subprograms that the work is 3725 specifically designed to require, such as by intimate data 3726 communication or control flow between those subprograms and other 3727 parts of the work. 3728 3729 The Corresponding Source need not include anything that users can 3730 regenerate automatically from other parts of the Corresponding 3731 Source. 3732 3733 The Corresponding Source for a work in source code form is that 3734 same work. 3735 3736 2. Basic Permissions. 3737 3738 All rights granted under this License are granted for the term of 3739 copyright on the Program, and are irrevocable provided the stated 3740 conditions are met. This License explicitly affirms your unlimited 3741 permission to run the unmodified Program. The output from running 3742 a covered work is covered by this License only if the output, given 3743 its content, constitutes a covered work. This License acknowledges 3744 your rights of fair use or other equivalent, as provided by 3745 copyright law. 3746 3747 You may make, run and propagate covered works that you do not 3748 convey, without conditions so long as your license otherwise 3749 remains in force. You may convey covered works to others for the 3750 sole purpose of having them make modifications exclusively for you, 3751 or provide you with facilities for running those works, provided 3752 that you comply with the terms of this License in conveying all 3753 material for which you do not control copyright. Those thus making 3754 or running the covered works for you must do so exclusively on your 3755 behalf, under your direction and control, on terms that prohibit 3756 them from making any copies of your copyrighted material outside 3757 their relationship with you. 3758 3759 Conveying under any other circumstances is permitted solely under 3760 the conditions stated below. Sublicensing is not allowed; section 3761 10 makes it unnecessary. 3762 3763 3. Protecting Users’ Legal Rights From Anti-Circumvention Law. 3764 3765 No covered work shall be deemed part of an effective technological 3766 measure under any applicable law fulfilling obligations under 3767 article 11 of the WIPO copyright treaty adopted on 20 December 3768 1996, or similar laws prohibiting or restricting circumvention of 3769 such measures. 3770 3771 When you convey a covered work, you waive any legal power to forbid 3772 circumvention of technological measures to the extent such 3773 circumvention is effected by exercising rights under this License 3774 with respect to the covered work, and you disclaim any intention to 3775 limit operation or modification of the work as a means of 3776 enforcing, against the work’s users, your or third parties’ legal 3777 rights to forbid circumvention of technological measures. 3778 3779 4. Conveying Verbatim Copies. 3780 3781 You may convey verbatim copies of the Program’s source code as you 3782 receive it, in any medium, provided that you conspicuously and 3783 appropriately publish on each copy an appropriate copyright notice; 3784 keep intact all notices stating that this License and any 3785 non-permissive terms added in accord with section 7 apply to the 3786 code; keep intact all notices of the absence of any warranty; and 3787 give all recipients a copy of this License along with the Program. 3788 3789 You may charge any price or no price for each copy that you convey, 3790 and you may offer support or warranty protection for a fee. 3791 3792 5. Conveying Modified Source Versions. 3793 3794 You may convey a work based on the Program, or the modifications to 3795 produce it from the Program, in the form of source code under the 3796 terms of section 4, provided that you also meet all of these 3797 conditions: 3798 3799 a. The work must carry prominent notices stating that you 3800 modified it, and giving a relevant date. 3801 3802 b. The work must carry prominent notices stating that it is 3803 released under this License and any conditions added under 3804 section 7. This requirement modifies the requirement in 3805 section 4 to “keep intact all notices”. 3806 3807 c. You must license the entire work, as a whole, under this 3808 License to anyone who comes into possession of a copy. This 3809 License will therefore apply, along with any applicable 3810 section 7 additional terms, to the whole of the work, and all 3811 its parts, regardless of how they are packaged. This License 3812 gives no permission to license the work in any other way, but 3813 it does not invalidate such permission if you have separately 3814 received it. 3815 3816 d. If the work has interactive user interfaces, each must display 3817 Appropriate Legal Notices; however, if the Program has 3818 interactive interfaces that do not display Appropriate Legal 3819 Notices, your work need not make them do so. 3820 3821 A compilation of a covered work with other separate and independent 3822 works, which are not by their nature extensions of the covered 3823 work, and which are not combined with it such as to form a larger 3824 program, in or on a volume of a storage or distribution medium, is 3825 called an “aggregate” if the compilation and its resulting 3826 copyright are not used to limit the access or legal rights of the 3827 compilation’s users beyond what the individual works permit. 3828 Inclusion of a covered work in an aggregate does not cause this 3829 License to apply to the other parts of the aggregate. 3830 3831 6. Conveying Non-Source Forms. 3832 3833 You may convey a covered work in object code form under the terms 3834 of sections 4 and 5, provided that you also convey the 3835 machine-readable Corresponding Source under the terms of this 3836 License, in one of these ways: 3837 3838 a. Convey the object code in, or embodied in, a physical product 3839 (including a physical distribution medium), accompanied by the 3840 Corresponding Source fixed on a durable physical medium 3841 customarily used for software interchange. 3842 3843 b. Convey the object code in, or embodied in, a physical product 3844 (including a physical distribution medium), accompanied by a 3845 written offer, valid for at least three years and valid for as 3846 long as you offer spare parts or customer support for that 3847 product model, to give anyone who possesses the object code 3848 either (1) a copy of the Corresponding Source for all the 3849 software in the product that is covered by this License, on a 3850 durable physical medium customarily used for software 3851 interchange, for a price no more than your reasonable cost of 3852 physically performing this conveying of source, or (2) access 3853 to copy the Corresponding Source from a network server at no 3854 charge. 3855 3856 c. Convey individual copies of the object code with a copy of the 3857 written offer to provide the Corresponding Source. This 3858 alternative is allowed only occasionally and noncommercially, 3859 and only if you received the object code with such an offer, 3860 in accord with subsection 6b. 3861 3862 d. Convey the object code by offering access from a designated 3863 place (gratis or for a charge), and offer equivalent access to 3864 the Corresponding Source in the same way through the same 3865 place at no further charge. You need not require recipients 3866 to copy the Corresponding Source along with the object code. 3867 If the place to copy the object code is a network server, the 3868 Corresponding Source may be on a different server (operated by 3869 you or a third party) that supports equivalent copying 3870 facilities, provided you maintain clear directions next to the 3871 object code saying where to find the Corresponding Source. 3872 Regardless of what server hosts the Corresponding Source, you 3873 remain obligated to ensure that it is available for as long as 3874 needed to satisfy these requirements. 3875 3876 e. Convey the object code using peer-to-peer transmission, 3877 provided you inform other peers where the object code and 3878 Corresponding Source of the work are being offered to the 3879 general public at no charge under subsection 6d. 3880 3881 A separable portion of the object code, whose source code is 3882 excluded from the Corresponding Source as a System Library, need 3883 not be included in conveying the object code work. 3884 3885 A “User Product” is either (1) a “consumer product”, which means 3886 any tangible personal property which is normally used for personal, 3887 family, or household purposes, or (2) anything designed or sold for 3888 incorporation into a dwelling. In determining whether a product is 3889 a consumer product, doubtful cases shall be resolved in favor of 3890 coverage. For a particular product received by a particular user, 3891 “normally used” refers to a typical or common use of that class of 3892 product, regardless of the status of the particular user or of the 3893 way in which the particular user actually uses, or expects or is 3894 expected to use, the product. A product is a consumer product 3895 regardless of whether the product has substantial commercial, 3896 industrial or non-consumer uses, unless such uses represent the 3897 only significant mode of use of the product. 3898 3899 “Installation Information” for a User Product means any methods, 3900 procedures, authorization keys, or other information required to 3901 install and execute modified versions of a covered work in that 3902 User Product from a modified version of its Corresponding Source. 3903 The information must suffice to ensure that the continued 3904 functioning of the modified object code is in no case prevented or 3905 interfered with solely because modification has been made. 3906 3907 If you convey an object code work under this section in, or with, 3908 or specifically for use in, a User Product, and the conveying 3909 occurs as part of a transaction in which the right of possession 3910 and use of the User Product is transferred to the recipient in 3911 perpetuity or for a fixed term (regardless of how the transaction 3912 is characterized), the Corresponding Source conveyed under this 3913 section must be accompanied by the Installation Information. But 3914 this requirement does not apply if neither you nor any third party 3915 retains the ability to install modified object code on the User 3916 Product (for example, the work has been installed in ROM). 3917 3918 The requirement to provide Installation Information does not 3919 include a requirement to continue to provide support service, 3920 warranty, or updates for a work that has been modified or installed 3921 by the recipient, or for the User Product in which it has been 3922 modified or installed. Access to a network may be denied when the 3923 modification itself materially and adversely affects the operation 3924 of the network or violates the rules and protocols for 3925 communication across the network. 3926 3927 Corresponding Source conveyed, and Installation Information 3928 provided, in accord with this section must be in a format that is 3929 publicly documented (and with an implementation available to the 3930 public in source code form), and must require no special password 3931 or key for unpacking, reading or copying. 3932 3933 7. Additional Terms. 3934 3935 “Additional permissions” are terms that supplement the terms of 3936 this License by making exceptions from one or more of its 3937 conditions. Additional permissions that are applicable to the 3938 entire Program shall be treated as though they were included in 3939 this License, to the extent that they are valid under applicable 3940 law. If additional permissions apply only to part of the Program, 3941 that part may be used separately under those permissions, but the 3942 entire Program remains governed by this License without regard to 3943 the additional permissions. 3944 3945 When you convey a copy of a covered work, you may at your option 3946 remove any additional permissions from that copy, or from any part 3947 of it. (Additional permissions may be written to require their own 3948 removal in certain cases when you modify the work.) You may place 3949 additional permissions on material, added by you to a covered work, 3950 for which you have or can give appropriate copyright permission. 3951 3952 Notwithstanding any other provision of this License, for material 3953 you add to a covered work, you may (if authorized by the copyright 3954 holders of that material) supplement the terms of this License with 3955 terms: 3956 3957 a. Disclaiming warranty or limiting liability differently from 3958 the terms of sections 15 and 16 of this License; or 3959 3960 b. Requiring preservation of specified reasonable legal notices 3961 or author attributions in that material or in the Appropriate 3962 Legal Notices displayed by works containing it; or 3963 3964 c. Prohibiting misrepresentation of the origin of that material, 3965 or requiring that modified versions of such material be marked 3966 in reasonable ways as different from the original version; or 3967 3968 d. Limiting the use for publicity purposes of names of licensors 3969 or authors of the material; or 3970 3971 e. Declining to grant rights under trademark law for use of some 3972 trade names, trademarks, or service marks; or 3973 3974 f. Requiring indemnification of licensors and authors of that 3975 material by anyone who conveys the material (or modified 3976 versions of it) with contractual assumptions of liability to 3977 the recipient, for any liability that these contractual 3978 assumptions directly impose on those licensors and authors. 3979 3980 All other non-permissive additional terms are considered “further 3981 restrictions” within the meaning of section 10. If the Program as 3982 you received it, or any part of it, contains a notice stating that 3983 it is governed by this License along with a term that is a further 3984 restriction, you may remove that term. If a license document 3985 contains a further restriction but permits relicensing or conveying 3986 under this License, you may add to a covered work material governed 3987 by the terms of that license document, provided that the further 3988 restriction does not survive such relicensing or conveying. 3989 3990 If you add terms to a covered work in accord with this section, you 3991 must place, in the relevant source files, a statement of the 3992 additional terms that apply to those files, or a notice indicating 3993 where to find the applicable terms. 3994 3995 Additional terms, permissive or non-permissive, may be stated in 3996 the form of a separately written license, or stated as exceptions; 3997 the above requirements apply either way. 3998 3999 8. Termination. 4000 4001 You may not propagate or modify a covered work except as expressly 4002 provided under this License. Any attempt otherwise to propagate or 4003 modify it is void, and will automatically terminate your rights 4004 under this License (including any patent licenses granted under the 4005 third paragraph of section 11). 4006 4007 However, if you cease all violation of this License, then your 4008 license from a particular copyright holder is reinstated (a) 4009 provisionally, unless and until the copyright holder explicitly and 4010 finally terminates your license, and (b) permanently, if the 4011 copyright holder fails to notify you of the violation by some 4012 reasonable means prior to 60 days after the cessation. 4013 4014 Moreover, your license from a particular copyright holder is 4015 reinstated permanently if the copyright holder notifies you of the 4016 violation by some reasonable means, this is the first time you have 4017 received notice of violation of this License (for any work) from 4018 that copyright holder, and you cure the violation prior to 30 days 4019 after your receipt of the notice. 4020 4021 Termination of your rights under this section does not terminate 4022 the licenses of parties who have received copies or rights from you 4023 under this License. If your rights have been terminated and not 4024 permanently reinstated, you do not qualify to receive new licenses 4025 for the same material under section 10. 4026 4027 9. Acceptance Not Required for Having Copies. 4028 4029 You are not required to accept this License in order to receive or 4030 run a copy of the Program. Ancillary propagation of a covered work 4031 occurring solely as a consequence of using peer-to-peer 4032 transmission to receive a copy likewise does not require 4033 acceptance. However, nothing other than this License grants you 4034 permission to propagate or modify any covered work. These actions 4035 infringe copyright if you do not accept this License. Therefore, 4036 by modifying or propagating a covered work, you indicate your 4037 acceptance of this License to do so. 4038 4039 10. Automatic Licensing of Downstream Recipients. 4040 4041 Each time you convey a covered work, the recipient automatically 4042 receives a license from the original licensors, to run, modify and 4043 propagate that work, subject to this License. You are not 4044 responsible for enforcing compliance by third parties with this 4045 License. 4046 4047 An “entity transaction” is a transaction transferring control of an 4048 organization, or substantially all assets of one, or subdividing an 4049 organization, or merging organizations. If propagation of a 4050 covered work results from an entity transaction, each party to that 4051 transaction who receives a copy of the work also receives whatever 4052 licenses to the work the party’s predecessor in interest had or 4053 could give under the previous paragraph, plus a right to possession 4054 of the Corresponding Source of the work from the predecessor in 4055 interest, if the predecessor has it or can get it with reasonable 4056 efforts. 4057 4058 You may not impose any further restrictions on the exercise of the 4059 rights granted or affirmed under this License. For example, you 4060 may not impose a license fee, royalty, or other charge for exercise 4061 of rights granted under this License, and you may not initiate 4062 litigation (including a cross-claim or counterclaim in a lawsuit) 4063 alleging that any patent claim is infringed by making, using, 4064 selling, offering for sale, or importing the Program or any portion 4065 of it. 4066 4067 11. Patents. 4068 4069 A “contributor” is a copyright holder who authorizes use under this 4070 License of the Program or a work on which the Program is based. 4071 The work thus licensed is called the contributor’s “contributor 4072 version”. 4073 4074 A contributor’s “essential patent claims” are all patent claims 4075 owned or controlled by the contributor, whether already acquired or 4076 hereafter acquired, that would be infringed by some manner, 4077 permitted by this License, of making, using, or selling its 4078 contributor version, but do not include claims that would be 4079 infringed only as a consequence of further modification of the 4080 contributor version. For purposes of this definition, “control” 4081 includes the right to grant patent sublicenses in a manner 4082 consistent with the requirements of this License. 4083 4084 Each contributor grants you a non-exclusive, worldwide, 4085 royalty-free patent license under the contributor’s essential 4086 patent claims, to make, use, sell, offer for sale, import and 4087 otherwise run, modify and propagate the contents of its contributor 4088 version. 4089 4090 In the following three paragraphs, a “patent license” is any 4091 express agreement or commitment, however denominated, not to 4092 enforce a patent (such as an express permission to practice a 4093 patent or covenant not to sue for patent infringement). To “grant” 4094 such a patent license to a party means to make such an agreement or 4095 commitment not to enforce a patent against the party. 4096 4097 If you convey a covered work, knowingly relying on a patent 4098 license, and the Corresponding Source of the work is not available 4099 for anyone to copy, free of charge and under the terms of this 4100 License, through a publicly available network server or other 4101 readily accessible means, then you must either (1) cause the 4102 Corresponding Source to be so available, or (2) arrange to deprive 4103 yourself of the benefit of the patent license for this particular 4104 work, or (3) arrange, in a manner consistent with the requirements 4105 of this License, to extend the patent license to downstream 4106 recipients. “Knowingly relying” means you have actual knowledge 4107 that, but for the patent license, your conveying the covered work 4108 in a country, or your recipient’s use of the covered work in a 4109 country, would infringe one or more identifiable patents in that 4110 country that you have reason to believe are valid. 4111 4112 If, pursuant to or in connection with a single transaction or 4113 arrangement, you convey, or propagate by procuring conveyance of, a 4114 covered work, and grant a patent license to some of the parties 4115 receiving the covered work authorizing them to use, propagate, 4116 modify or convey a specific copy of the covered work, then the 4117 patent license you grant is automatically extended to all 4118 recipients of the covered work and works based on it. 4119 4120 A patent license is “discriminatory” if it does not include within 4121 the scope of its coverage, prohibits the exercise of, or is 4122 conditioned on the non-exercise of one or more of the rights that 4123 are specifically granted under this License. You may not convey a 4124 covered work if you are a party to an arrangement with a third 4125 party that is in the business of distributing software, under which 4126 you make payment to the third party based on the extent of your 4127 activity of conveying the work, and under which the third party 4128 grants, to any of the parties who would receive the covered work 4129 from you, a discriminatory patent license (a) in connection with 4130 copies of the covered work conveyed by you (or copies made from 4131 those copies), or (b) primarily for and in connection with specific 4132 products or compilations that contain the covered work, unless you 4133 entered into that arrangement, or that patent license was granted, 4134 prior to 28 March 2007. 4135 4136 Nothing in this License shall be construed as excluding or limiting 4137 any implied license or other defenses to infringement that may 4138 otherwise be available to you under applicable patent law. 4139 4140 12. No Surrender of Others’ Freedom. 4141 4142 If conditions are imposed on you (whether by court order, agreement 4143 or otherwise) that contradict the conditions of this License, they 4144 do not excuse you from the conditions of this License. If you 4145 cannot convey a covered work so as to satisfy simultaneously your 4146 obligations under this License and any other pertinent obligations, 4147 then as a consequence you may not convey it at all. For example, 4148 if you agree to terms that obligate you to collect a royalty for 4149 further conveying from those to whom you convey the Program, the 4150 only way you could satisfy both those terms and this License would 4151 be to refrain entirely from conveying the Program. 4152 4153 13. Use with the GNU Affero General Public License. 4154 4155 Notwithstanding any other provision of this License, you have 4156 permission to link or combine any covered work with a work licensed 4157 under version 3 of the GNU Affero General Public License into a 4158 single combined work, and to convey the resulting work. The terms 4159 of this License will continue to apply to the part which is the 4160 covered work, but the special requirements of the GNU Affero 4161 General Public License, section 13, concerning interaction through 4162 a network will apply to the combination as such. 4163 4164 14. Revised Versions of this License. 4165 4166 The Free Software Foundation may publish revised and/or new 4167 versions of the GNU General Public License from time to time. Such 4168 new versions will be similar in spirit to the present version, but 4169 may differ in detail to address new problems or concerns. 4170 4171 Each version is given a distinguishing version number. If the 4172 Program specifies that a certain numbered version of the GNU 4173 General Public License “or any later version” applies to it, you 4174 have the option of following the terms and conditions either of 4175 that numbered version or of any later version published by the Free 4176 Software Foundation. If the Program does not specify a version 4177 number of the GNU General Public License, you may choose any 4178 version ever published by the Free Software Foundation. 4179 4180 If the Program specifies that a proxy can decide which future 4181 versions of the GNU General Public License can be used, that 4182 proxy’s public statement of acceptance of a version permanently 4183 authorizes you to choose that version for the Program. 4184 4185 Later license versions may give you additional or different 4186 permissions. However, no additional obligations are imposed on any 4187 author or copyright holder as a result of your choosing to follow a 4188 later version. 4189 4190 15. Disclaimer of Warranty. 4191 4192 THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 4193 APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE 4194 COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM “AS IS” 4195 WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, 4196 INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 4197 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE 4198 RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. 4199 SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL 4200 NECESSARY SERVICING, REPAIR OR CORRECTION. 4201 4202 16. Limitation of Liability. 4203 4204 IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN 4205 WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES 4206 AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR 4207 DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR 4208 CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE 4209 THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA 4210 BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 4211 PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER 4212 PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF 4213 THE POSSIBILITY OF SUCH DAMAGES. 4214 4215 17. Interpretation of Sections 15 and 16. 4216 4217 If the disclaimer of warranty and limitation of liability provided 4218 above cannot be given local legal effect according to their terms, 4219 reviewing courts shall apply local law that most closely 4220 approximates an absolute waiver of all civil liability in 4221 connection with the Program, unless a warranty or assumption of 4222 liability accompanies a copy of the Program in return for a fee. 4223 4224 END OF TERMS AND CONDITIONS 4225 =========================== 4226 4227 How to Apply These Terms to Your New Programs 4228 ============================================= 4229 4230 If you develop a new program, and you want it to be of the greatest 4231 possible use to the public, the best way to achieve this is to make it 4232 free software which everyone can redistribute and change under these 4233 terms. 4234 4235 To do so, attach the following notices to the program. It is safest 4236 to attach them to the start of each source file to most effectively 4237 state the exclusion of warranty; and each file should have at least the 4238 “copyright” line and a pointer to where the full notice is found. 4239 4240 ONE LINE TO GIVE THE PROGRAM'S NAME AND A BRIEF IDEA OF WHAT IT DOES. 4241 Copyright (C) YEAR NAME OF AUTHOR 4242 4243 This program is free software: you can redistribute it and/or modify 4244 it under the terms of the GNU General Public License as published by 4245 the Free Software Foundation, either version 3 of the License, or (at 4246 your option) any later version. 4247 4248 This program is distributed in the hope that it will be useful, but 4249 WITHOUT ANY WARRANTY; without even the implied warranty of 4250 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 4251 General Public License for more details. 4252 4253 You should have received a copy of the GNU General Public License 4254 along with this program. If not, see <https://www.gnu.org/licenses/>. 4255 4256 Also add information on how to contact you by electronic and paper 4257 mail. 4258 4259 If the program does terminal interaction, make it output a short 4260 notice like this when it starts in an interactive mode: 4261 4262 PROGRAM Copyright (C) YEAR NAME OF AUTHOR 4263 This program comes with ABSOLUTELY NO WARRANTY; for details type ‘show w’. 4264 This is free software, and you are welcome to redistribute it 4265 under certain conditions; type ‘show c’ for details. 4266 4267 The hypothetical commands ‘show w’ and ‘show c’ should show the 4268 appropriate parts of the General Public License. Of course, your 4269 program’s commands might be different; for a GUI interface, you would 4270 use an “about box”. 4271 4272 You should also get your employer (if you work as a programmer) or 4273 school, if any, to sign a “copyright disclaimer” for the program, if 4274 necessary. For more information on this, and how to apply and follow 4275 the GNU GPL, see <https://www.gnu.org/licenses/>. 4276 4277 The GNU General Public License does not permit incorporating your 4278 program into proprietary programs. If your program is a subroutine 4279 library, you may consider it more useful to permit linking proprietary 4280 applications with the library. If this is what you want to do, use the 4281 GNU Lesser General Public License instead of this License. But first, 4282 please read <https://www.gnu.org/licenses/why-not-lgpl.html>. 4283 4284 4285 File: dash.info, Node: Index, Prev: GPL, Up: Top 4286 4287 Index 4288 ***** 4289 4290 4291 * Menu: 4292 4293 * !cdr: Destructive operations. 4294 (line 16) 4295 * !cons: Destructive operations. 4296 (line 8) 4297 * -->: Threading macros. (line 35) 4298 * ->: Threading macros. (line 9) 4299 * ->>: Threading macros. (line 22) 4300 * -all?: Predicates. (line 53) 4301 * -andfn: Function combinators. 4302 (line 184) 4303 * -annotate: Maps. (line 84) 4304 * -any?: Predicates. (line 41) 4305 * -applify: Function combinators. 4306 (line 63) 4307 * -as->: Threading macros. (line 49) 4308 * -butlast: Other list operations. 4309 (line 335) 4310 * -clone: Tree operations. (line 122) 4311 * -common-prefix: Reductions. (line 242) 4312 * -common-suffix: Reductions. (line 252) 4313 * -compose: Function combinators. 4314 (line 49) 4315 * -concat: List to list. (line 23) 4316 * -cons*: Other list operations. 4317 (line 30) 4318 * -cons-pair?: Predicates. (line 167) 4319 * -const: Function combinators. 4320 (line 128) 4321 * -contains?: Predicates. (line 100) 4322 * -copy: Maps. (line 139) 4323 * -count: Reductions. (line 172) 4324 * -cut: Function combinators. 4325 (line 140) 4326 * -cycle: Other list operations. 4327 (line 180) 4328 * -difference: Set operations. (line 20) 4329 * -distinct: Set operations. (line 62) 4330 * -dotimes: Side effects. (line 80) 4331 * -doto: Threading macros. (line 99) 4332 * -drop: Sublist selection. (line 147) 4333 * -drop-last: Sublist selection. (line 161) 4334 * -drop-while: Sublist selection. (line 192) 4335 * -each: Side effects. (line 8) 4336 * -each-indexed: Side effects. (line 38) 4337 * -each-r: Side effects. (line 52) 4338 * -each-r-while: Side effects. (line 65) 4339 * -each-while: Side effects. (line 24) 4340 * -elem-index: Indexing. (line 9) 4341 * -elem-indices: Indexing. (line 21) 4342 * -every: Predicates. (line 23) 4343 * -fifth-item: Other list operations. 4344 (line 315) 4345 * -filter: Sublist selection. (line 8) 4346 * -find-index: Indexing. (line 32) 4347 * -find-indices: Indexing. (line 60) 4348 * -find-last-index: Indexing. (line 46) 4349 * -first: Other list operations. 4350 (line 246) 4351 * -first-item: Other list operations. 4352 (line 272) 4353 * -fix: Other list operations. 4354 (line 375) 4355 * -fixfn: Function combinators. 4356 (line 224) 4357 * -flatten: List to list. (line 34) 4358 * -flatten-n: List to list. (line 56) 4359 * -flip: Function combinators. 4360 (line 95) 4361 * -fourth-item: Other list operations. 4362 (line 305) 4363 * -grade-down: Indexing. (line 81) 4364 * -grade-up: Indexing. (line 71) 4365 * -group-by: Partitioning. (line 194) 4366 * -if-let: Binding. (line 34) 4367 * -if-let*: Binding. (line 45) 4368 * -inits: Reductions. (line 222) 4369 * -insert-at: List to list. (line 110) 4370 * -interleave: Other list operations. 4371 (line 67) 4372 * -interpose: Other list operations. 4373 (line 57) 4374 * -intersection: Set operations. (line 32) 4375 * -iota: Other list operations. 4376 (line 78) 4377 * -is-infix?: Predicates. (line 153) 4378 * -is-prefix?: Predicates. (line 129) 4379 * -is-suffix?: Predicates. (line 141) 4380 * -iterate: Unfolding. (line 9) 4381 * -iteratefn: Function combinators. 4382 (line 201) 4383 * -juxt: Function combinators. 4384 (line 37) 4385 * -keep: List to list. (line 8) 4386 * -lambda: Binding. (line 247) 4387 * -last: Other list operations. 4388 (line 262) 4389 * -last-item: Other list operations. 4390 (line 325) 4391 * -let: Binding. (line 61) 4392 * -let*: Binding. (line 227) 4393 * -list: Other list operations. 4394 (line 358) 4395 * -map: Maps. (line 10) 4396 * -map-first: Maps. (line 38) 4397 * -map-indexed: Maps. (line 66) 4398 * -map-last: Maps. (line 52) 4399 * -map-when: Maps. (line 22) 4400 * -mapcat: Maps. (line 128) 4401 * -max: Reductions. (line 286) 4402 * -max-by: Reductions. (line 296) 4403 * -min: Reductions. (line 262) 4404 * -min-by: Reductions. (line 272) 4405 * -non-nil: Sublist selection. (line 94) 4406 * -none?: Predicates. (line 73) 4407 * -not: Function combinators. 4408 (line 153) 4409 * -on: Function combinators. 4410 (line 75) 4411 * -only-some?: Predicates. (line 85) 4412 * -orfn: Function combinators. 4413 (line 167) 4414 * -pad: Other list operations. 4415 (line 191) 4416 * -partial: Function combinators. 4417 (line 8) 4418 * -partition: Partitioning. (line 80) 4419 * -partition-after-item: Partitioning. (line 184) 4420 * -partition-after-pred: Partitioning. (line 151) 4421 * -partition-all: Partitioning. (line 92) 4422 * -partition-all-in-steps: Partitioning. (line 115) 4423 * -partition-before-item: Partitioning. (line 174) 4424 * -partition-before-pred: Partitioning. (line 163) 4425 * -partition-by: Partitioning. (line 127) 4426 * -partition-by-header: Partitioning. (line 138) 4427 * -partition-in-steps: Partitioning. (line 103) 4428 * -permutations: Set operations. (line 52) 4429 * -powerset: Set operations. (line 44) 4430 * -prodfn: Function combinators. 4431 (line 258) 4432 * -product: Reductions. (line 201) 4433 * -reduce: Reductions. (line 53) 4434 * -reduce-from: Reductions. (line 8) 4435 * -reduce-r: Reductions. (line 72) 4436 * -reduce-r-from: Reductions. (line 26) 4437 * -reductions: Reductions. (line 136) 4438 * -reductions-from: Reductions. (line 100) 4439 * -reductions-r: Reductions. (line 154) 4440 * -reductions-r-from: Reductions. (line 118) 4441 * -remove: Sublist selection. (line 26) 4442 * -remove-at: List to list. (line 146) 4443 * -remove-at-indices: List to list. (line 159) 4444 * -remove-first: Sublist selection. (line 43) 4445 * -remove-item: Sublist selection. (line 83) 4446 * -remove-last: Sublist selection. (line 64) 4447 * -repeat: Other list operations. 4448 (line 19) 4449 * -replace: List to list. (line 68) 4450 * -replace-at: List to list. (line 121) 4451 * -replace-first: List to list. (line 82) 4452 * -replace-last: List to list. (line 96) 4453 * -rotate: Other list operations. 4454 (line 8) 4455 * -rotate-args: Function combinators. 4456 (line 112) 4457 * -rpartial: Function combinators. 4458 (line 22) 4459 * -running-product: Reductions. (line 211) 4460 * -running-sum: Reductions. (line 190) 4461 * -same-items?: Predicates. (line 115) 4462 * -second-item: Other list operations. 4463 (line 285) 4464 * -select-by-indices: Sublist selection. (line 208) 4465 * -select-column: Sublist selection. (line 238) 4466 * -select-columns: Sublist selection. (line 219) 4467 * -separate: Partitioning. (line 69) 4468 * -setq: Binding. (line 270) 4469 * -slice: Sublist selection. (line 104) 4470 * -snoc: Other list operations. 4471 (line 43) 4472 * -some: Predicates. (line 8) 4473 * -some-->: Threading macros. (line 86) 4474 * -some->: Threading macros. (line 62) 4475 * -some->>: Threading macros. (line 74) 4476 * -sort: Other list operations. 4477 (line 345) 4478 * -splice: Maps. (line 95) 4479 * -splice-list: Maps. (line 115) 4480 * -split-at: Partitioning. (line 8) 4481 * -split-on: Partitioning. (line 34) 4482 * -split-when: Partitioning. (line 52) 4483 * -split-with: Partitioning. (line 23) 4484 * -sum: Reductions. (line 180) 4485 * -table: Other list operations. 4486 (line 202) 4487 * -table-flat: Other list operations. 4488 (line 221) 4489 * -tails: Reductions. (line 232) 4490 * -take: Sublist selection. (line 120) 4491 * -take-last: Sublist selection. (line 133) 4492 * -take-while: Sublist selection. (line 175) 4493 * -third-item: Other list operations. 4494 (line 295) 4495 * -tree-map: Tree operations. (line 28) 4496 * -tree-map-nodes: Tree operations. (line 39) 4497 * -tree-mapreduce: Tree operations. (line 84) 4498 * -tree-mapreduce-from: Tree operations. (line 103) 4499 * -tree-reduce: Tree operations. (line 52) 4500 * -tree-reduce-from: Tree operations. (line 69) 4501 * -tree-seq: Tree operations. (line 8) 4502 * -unfold: Unfolding. (line 25) 4503 * -union: Set operations. (line 8) 4504 * -unzip: Other list operations. 4505 (line 158) 4506 * -update-at: List to list. (line 133) 4507 * -when-let: Binding. (line 9) 4508 * -when-let*: Binding. (line 21) 4509 * -zip: Other list operations. 4510 (line 107) 4511 * -zip-fill: Other list operations. 4512 (line 150) 4513 * -zip-lists: Other list operations. 4514 (line 131) 4515 * -zip-with: Other list operations. 4516 (line 91) 4517 * dash-fontify-mode: Fontification of special variables. 4518 (line 6) 4519 * dash-register-info-lookup: Info symbol lookup. (line 6) 4520 * global-dash-fontify-mode: Fontification of special variables. 4521 (line 12) 4522 4523 4524 4525 Tag Table: 4526 Node: Top742 4527 Node: Installation2397 4528 Node: Using in a package3159 4529 Node: Fontification of special variables3504 4530 Node: Info symbol lookup4294 4531 Node: Functions4877 4532 Node: Maps6361 4533 Ref: -map6658 4534 Ref: -map-when7031 4535 Ref: -map-first7606 4536 Ref: -map-last8081 4537 Ref: -map-indexed8551 4538 Ref: -annotate9237 4539 Ref: -splice9724 4540 Ref: -splice-list10502 4541 Ref: -mapcat10961 4542 Ref: -copy11334 4543 Node: Sublist selection11522 4544 Ref: -filter11715 4545 Ref: -remove12262 4546 Ref: -remove-first12800 4547 Ref: -remove-last13642 4548 Ref: -remove-item14367 4549 Ref: -non-nil14767 4550 Ref: -slice15043 4551 Ref: -take15572 4552 Ref: -take-last15979 4553 Ref: -drop16410 4554 Ref: -drop-last16851 4555 Ref: -take-while17277 4556 Ref: -drop-while17892 4557 Ref: -select-by-indices18508 4558 Ref: -select-columns19019 4559 Ref: -select-column19722 4560 Node: List to list20185 4561 Ref: -keep20377 4562 Ref: -concat20941 4563 Ref: -flatten21235 4564 Ref: -flatten-n21991 4565 Ref: -replace22375 4566 Ref: -replace-first22836 4567 Ref: -replace-last23331 4568 Ref: -insert-at23819 4569 Ref: -replace-at24144 4570 Ref: -update-at24531 4571 Ref: -remove-at25019 4572 Ref: -remove-at-indices25504 4573 Node: Reductions26083 4574 Ref: -reduce-from26279 4575 Ref: -reduce-r-from27003 4576 Ref: -reduce28266 4577 Ref: -reduce-r29017 4578 Ref: -reductions-from30295 4579 Ref: -reductions-r-from31101 4580 Ref: -reductions31931 4581 Ref: -reductions-r32642 4582 Ref: -count33387 4583 Ref: -sum33611 4584 Ref: -running-sum33799 4585 Ref: -product34120 4586 Ref: -running-product34328 4587 Ref: -inits34669 4588 Ref: -tails34914 4589 Ref: -common-prefix35158 4590 Ref: -common-suffix35452 4591 Ref: -min35746 4592 Ref: -min-by35972 4593 Ref: -max36493 4594 Ref: -max-by36718 4595 Node: Unfolding37244 4596 Ref: -iterate37485 4597 Ref: -unfold37932 4598 Node: Predicates38737 4599 Ref: -some38914 4600 Ref: -every39331 4601 Ref: -any?40010 4602 Ref: -all?40341 4603 Ref: -none?41048 4604 Ref: -only-some?41350 4605 Ref: -contains?41835 4606 Ref: -same-items?42224 4607 Ref: -is-prefix?42609 4608 Ref: -is-suffix?42935 4609 Ref: -is-infix?43261 4610 Ref: -cons-pair?43615 4611 Node: Partitioning43940 4612 Ref: -split-at44128 4613 Ref: -split-with44792 4614 Ref: -split-on45192 4615 Ref: -split-when45863 4616 Ref: -separate46500 4617 Ref: -partition46939 4618 Ref: -partition-all47388 4619 Ref: -partition-in-steps47813 4620 Ref: -partition-all-in-steps48307 4621 Ref: -partition-by48789 4622 Ref: -partition-by-header49167 4623 Ref: -partition-after-pred49768 4624 Ref: -partition-before-pred50215 4625 Ref: -partition-before-item50600 4626 Ref: -partition-after-item50907 4627 Ref: -group-by51209 4628 Node: Indexing51642 4629 Ref: -elem-index51844 4630 Ref: -elem-indices52239 4631 Ref: -find-index52619 4632 Ref: -find-last-index53108 4633 Ref: -find-indices53612 4634 Ref: -grade-up54017 4635 Ref: -grade-down54424 4636 Node: Set operations54838 4637 Ref: -union55021 4638 Ref: -difference55459 4639 Ref: -intersection55871 4640 Ref: -powerset56303 4641 Ref: -permutations56513 4642 Ref: -distinct56809 4643 Node: Other list operations57183 4644 Ref: -rotate57408 4645 Ref: -repeat57761 4646 Ref: -cons*58040 4647 Ref: -snoc58456 4648 Ref: -interpose58866 4649 Ref: -interleave59160 4650 Ref: -iota59526 4651 Ref: -zip-with60009 4652 Ref: -zip60723 4653 Ref: -zip-lists61552 4654 Ref: -zip-fill62250 4655 Ref: -unzip62572 4656 Ref: -cycle63314 4657 Ref: -pad63713 4658 Ref: -table64032 4659 Ref: -table-flat64818 4660 Ref: -first65823 4661 Ref: -last66309 4662 Ref: -first-item66643 4663 Ref: -second-item67042 4664 Ref: -third-item67306 4665 Ref: -fourth-item67568 4666 Ref: -fifth-item67834 4667 Ref: -last-item68096 4668 Ref: -butlast68387 4669 Ref: -sort68632 4670 Ref: -list69118 4671 Ref: -fix69687 4672 Node: Tree operations70176 4673 Ref: -tree-seq70372 4674 Ref: -tree-map71227 4675 Ref: -tree-map-nodes71667 4676 Ref: -tree-reduce72514 4677 Ref: -tree-reduce-from73396 4678 Ref: -tree-mapreduce73996 4679 Ref: -tree-mapreduce-from74855 4680 Ref: -clone76140 4681 Node: Threading macros76467 4682 Ref: ->76692 4683 Ref: ->>77180 4684 Ref: -->77683 4685 Ref: -as->78239 4686 Ref: -some->78693 4687 Ref: -some->>79066 4688 Ref: -some-->79501 4689 Ref: -doto80050 4690 Node: Binding80603 4691 Ref: -when-let80810 4692 Ref: -when-let*81265 4693 Ref: -if-let81788 4694 Ref: -if-let*82148 4695 Ref: -let82765 4696 Ref: -let*88837 4697 Ref: -lambda89774 4698 Ref: -setq90580 4699 Node: Side effects91381 4700 Ref: -each91575 4701 Ref: -each-while92096 4702 Ref: -each-indexed92698 4703 Ref: -each-r93284 4704 Ref: -each-r-while93720 4705 Ref: -dotimes94346 4706 Node: Destructive operations94899 4707 Ref: !cons95117 4708 Ref: !cdr95321 4709 Node: Function combinators95514 4710 Ref: -partial95718 4711 Ref: -rpartial96236 4712 Ref: -juxt96884 4713 Ref: -compose97336 4714 Ref: -applify97943 4715 Ref: -on98373 4716 Ref: -flip99145 4717 Ref: -rotate-args99669 4718 Ref: -const100298 4719 Ref: -cut100640 4720 Ref: -not101120 4721 Ref: -orfn101646 4722 Ref: -andfn102408 4723 Ref: -iteratefn103164 4724 Ref: -fixfn103866 4725 Ref: -prodfn105422 4726 Node: Development106480 4727 Node: Contribute106769 4728 Node: Contributors107781 4729 Node: FDL109874 4730 Node: GPL135194 4731 Node: Index172943 4732 4733 End Tag Table 4734 4735 4736 Local Variables: 4737 coding: utf-8 4738 End: