(append) list1 list2
=========
#true
(003) "append" list1 list2
(car) pair
=========
#true
(002) "car" pair
(cdr) pair
=========
#true
(002) "cdr" pair
(cons) one two
=========
#true
(003) "cons" one two
(map) function list
=========
#true
(003) "map" function list
(merge) comparator list1 list2
BRING IN A COLLECT ARGUMENT
#true
(merge01) comparator list1 list2 nil
(merge01) comparator list1 list2 collect
LIST2 EXHAUSTED
(null?) list2
(append) (reverse) collect list1
(merge01) comparator list1 list2 collect
LIST1 EXHAUSTED
(null?) list1
(append) (reverse) collect list2
(merge01) comparator list1 list2 collect
NOW LIST2
(003) comparator (car) list2 (car) list1
(merge01) comparator
list1
(cdr) list2
(cons) (car) list2 collect
(merge01) comparator list1 list2 collect
NOW LIST1
#true
(merge01) comparator
(cdr) list1
list2
(cons) (car) list1 collect
(null?) value
=========
#true
(002) "null?" value
(reverse) list
=========
#true
(002) "reverse" list
(sort) comparator jumble
PREPARE JUMBLE AND PERFORM MERGE PASSES
#true
(car) (sort02) comparator (sort01) jumble
(sort01) jumble
PREPARE
#true
(map) "list" jumble
(sort02) comparator jumble
MERGE ALL
(null?) jumble
nil
(sort02) comparator jumble
ONE LIST
(null?) (cdr) jumble
jumble
(sort02) comparator jumble
SORT MERGE SORT
#true
(sort02) comparator
(cons) (merge) comparator (car) jumble (002) "cadr" jumble
(sort02) comparator (002) "cddr" jumble
(1 1 2 3 3 4 5 5 5 6 7 8 9 9 9)
ZED (a self-hosting compiler on ideone.com) This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or distribute this software, either in source code form or as a compiled binary, for any purpose, commercial or non-commercial, and by any means.
In jurisdictions that recognize copyright laws, the author or authors of this software dedicate any and all copyright interest in the software to the public domain. We make this dedication for the benefit of the public at large and to the detriment of our heirs and successors. We intend this dedication to be an overt act of relinquishment in perpetuity of all present and future rights to this software under copyright law.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
For more information, please refer to <http://u...content-available-to-author-only...e.org/>