home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / gnu / lucid / lemacs-19.6 / lisp / pcl-cvs / elib-dll.elc < prev    next >
Emacs Compiled Lisp  |  1993-04-01  |  6.0 KB

open in: MacOS 8.1     |     Win98     |     DOS

view JSON data     |     view as text


This file was processed as: Emacs Compiled Lisp (other/emacsCompiledLisp).
This format is not currently supported by dexvert.

ConfidenceProgramDetectionMatch TypeSupport
1% dexvert Emacs Compiled Lisp (other/emacsCompiledLisp) magic Unsupported
1% dexvert Combustion 2 Particle Library (other/combustion2ParticleLibrary) ext Unsupported
100% file Emacs/XEmacs v19 byte-compiled Lisp data default
99% file data default
100% TrID Emacs/XEmacs byte-compiled Lisp (generic) default
100% xdgMime text/x-emacs-lisp default (weak)



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 3b 45 4c 43 13 00 00 00 | 0a 3b 3b 3b 20 63 6f 6d |;ELC....|.;;; com|
|00000010| 70 69 6c 65 64 20 62 79 | 20 6a 77 7a 40 74 68 61 |piled by| jwz@tha|
|00000020| 6c 69 64 6f 6d 69 64 65 | 20 6f 6e 20 4d 6f 6e 20 |lidomide| on Mon |
|00000030| 46 65 62 20 20 31 20 31 | 39 3a 31 39 3a 34 39 20 |Feb 1 1|9:19:49 |
|00000040| 31 39 39 33 0a 3b 3b 3b | 20 66 72 6f 6d 20 66 69 |1993.;;;| from fi|
|00000050| 6c 65 20 2f 63 61 64 69 | 6c 6c 61 63 31 2f 63 6f |le /cadi|llac1/co|
|00000060| 64 65 2f 62 75 69 6c 64 | 2f 6c 65 6d 61 63 73 2f |de/build|/lemacs/|
|00000070| 6c 69 73 70 2f 70 63 6c | 2d 63 76 73 2f 65 6c 69 |lisp/pcl|-cvs/eli|
|00000080| 62 2d 64 6c 6c 2e 65 6c | 0a 3b 3b 3b 20 65 6d 61 |b-dll.el|.;;; ema|
|00000090| 63 73 20 76 65 72 73 69 | 6f 6e 20 31 39 2e 34 2e |cs versi|on 19.4.|
|000000a0| 31 33 20 4c 75 63 69 64 | 2e 0a 3b 3b 3b 20 62 79 |13 Lucid|..;;; by|
|000000b0| 74 65 63 6f 6d 70 20 76 | 65 72 73 69 6f 6e 20 32 |tecomp v|ersion 2|
|000000c0| 2e 31 30 3b 20 20 31 2d | 66 65 62 2d 39 33 2e 0a |.10; 1-|feb-93..|
|000000d0| 3b 3b 3b 20 6f 70 74 69 | 6d 69 7a 61 74 69 6f 6e |;;; opti|mization|
|000000e0| 20 69 73 20 6f 6e 2e 0a | 3b 3b 3b 20 74 68 69 73 | is on..|;;; this|
|000000f0| 20 66 69 6c 65 20 75 73 | 65 73 20 6f 70 63 6f 64 | file us|es opcod|
|00000100| 65 73 20 77 68 69 63 68 | 20 64 6f 20 6e 6f 74 20 |es which| do not |
|00000110| 65 78 69 73 74 20 69 6e | 20 45 6d 61 63 73 31 38 |exist in| Emacs18|
|00000120| 2e 0a 0a 28 69 66 20 28 | 61 6e 64 20 28 62 6f 75 |...(if (|and (bou|
|00000130| 6e 64 70 20 27 65 6d 61 | 63 73 2d 76 65 72 73 69 |ndp 'ema|cs-versi|
|00000140| 6f 6e 29 0a 09 20 28 6f | 72 20 28 61 6e 64 20 28 |on).. (o|r (and (|
|00000150| 62 6f 75 6e 64 70 20 27 | 65 70 6f 63 68 3a 3a 76 |boundp '|epoch::v|
|00000160| 65 72 73 69 6f 6e 29 20 | 65 70 6f 63 68 3a 3a 76 |ersion) |epoch::v|
|00000170| 65 72 73 69 6f 6e 29 0a | 09 20 20 20 20 20 28 73 |ersion).|. (s|
|00000180| 74 72 69 6e 67 2d 6c 65 | 73 73 70 20 65 6d 61 63 |tring-le|ssp emac|
|00000190| 73 2d 76 65 72 73 69 6f | 6e 20 22 31 39 22 29 29 |s-versio|n "19"))|
|000001a0| 29 0a 20 20 20 20 28 65 | 72 72 6f 72 20 22 54 68 |). (e|rror "Th|
|000001b0| 69 73 20 66 69 6c 65 20 | 77 61 73 20 63 6f 6d 70 |is file |was comp|
|000001c0| 69 6c 65 64 20 66 6f 72 | 20 45 6d 61 63 73 31 39 |iled for| Emacs19|
|000001d0| 2e 22 29 29 0a 0a 28 62 | 79 74 65 2d 63 6f 64 65 |."))..(b|yte-code|
|000001e0| 20 22 c0 c1 21 88 c2 c3 | 21 88 c4 c5 4d 88 c6 c7 | "..!...|!...M...|
|000001f0| 4d 88 c8 c9 4d 87 22 20 | 5b 72 65 71 75 69 72 65 |M...M." |[require|
|00000200| 20 65 6c 69 62 2d 6e 6f | 64 65 20 70 72 6f 76 69 | elib-no|de provi|
|00000210| 64 65 20 65 6c 69 62 2d | 64 6c 6c 20 64 6c 6c 2d |de elib-|dll dll-|
|00000220| 67 65 74 2d 64 75 6d 6d | 79 2d 6e 6f 64 65 20 23 |get-dumm|y-node #|
|00000230| 5b 28 64 6c 6c 29 20 22 | 08 41 87 22 20 5b 64 6c |[(dll) "|.A." [dl|
|00000240| 6c 5d 20 31 5d 20 64 6c | 6c 2d 6c 69 73 74 2d 6e |l] 1] dl|l-list-n|
|00000250| 6f 64 65 73 20 23 5b 28 | 64 6c 6c 29 20 22 c0 19 |odes #[(|dll) "..|
|00000260| c2 0b 21 89 1c c5 48 89 | 1e 06 0c 3d ac 8e 0e 06 |..!...H.|...=....|
|00000270| 09 42 11 0e 06 c5 48 89 | 16 06 aa 6e 09 2b 87 22 |.B....H.|...n.+."|
|00000280| 20 5b 6e 69 6c 20 72 65 | 73 75 6c 74 20 64 6c 6c | [nil re|sult dll|
|00000290| 2d 67 65 74 2d 64 75 6d | 6d 79 2d 6e 6f 64 65 20 |-get-dum|my-node |
|000002a0| 64 6c 6c 20 64 75 6d 6d | 79 20 30 20 6e 6f 64 65 |dll dumm|y 0 node|
|000002b0| 5d 20 33 5d 20 64 6c 6c | 2d 73 65 74 2d 66 72 6f |] 3] dll|-set-fro|
|000002c0| 6d 2d 6e 6f 64 65 2d 6c | 69 73 74 20 23 5b 28 64 |m-node-l|ist #[(d|
|000002d0| 6c 6c 20 6c 69 73 74 29 | 20 22 c0 09 21 88 c2 09 |ll list)| "..!...|
|000002e0| 21 89 1b 1c 0d ab 95 0d | 40 c6 0c 49 88 0c c7 0d |!.......|@..I....|
|000002f0| 40 49 88 0d 40 14 0d 41 | 89 15 ac 6b 0c c7 0b 49 |@I..@..A|...k...I|
|00000300| 88 0b c6 0c 49 2a 87 22 | 20 5b 64 6c 6c 2d 63 6c |....I*."| [dll-cl|
|00000310| 65 61 72 20 64 6c 6c 20 | 64 6c 6c 2d 67 65 74 2d |ear dll |dll-get-|
|00000320| 64 75 6d 6d 79 2d 6e 6f | 64 65 20 64 75 6d 6d 79 |dummy-no|de dummy|
|00000330| 20 6c 65 66 74 20 6c 69 | 73 74 20 30 20 31 5d 20 | left li|st 0 1] |
|00000340| 34 5d 5d 20 32 29 0a 28 | 66 73 65 74 20 27 64 6c |4]] 2).(|fset 'dl|
|00000350| 6c 2d 65 6c 65 6d 65 6e | 74 20 27 28 6d 61 63 72 |l-elemen|t '(macr|
|00000360| 6f 20 2e 20 23 5b 28 64 | 6c 6c 20 6e 6f 64 65 29 |o . #[(d|ll node)|
|00000370| 20 22 c0 09 44 87 22 20 | 5b 65 6c 69 62 2d 6e 6f | "..D." |[elib-no|
|00000380| 64 65 2d 64 61 74 61 20 | 6e 6f 64 65 5d 20 32 20 |de-data |node] 2 |
|00000390| 22 5c 0a 47 65 74 20 74 | 68 65 20 65 6c 65 6d 65 |"\.Get t|he eleme|
|000003a0| 6e 74 20 6f 66 20 61 20 | 4e 4f 44 45 20 69 6e 20 |nt of a |NODE in |
|000003b0| 61 20 64 6f 75 62 6c 79 | 20 6c 69 6e 6b 65 64 20 |a doubly| linked |
|000003c0| 6c 69 73 74 20 44 4c 4c | 2e 0a 41 72 67 73 3a 20 |list DLL|..Args: |
|000003d0| 44 4c 4c 20 4e 4f 44 45 | 2e 22 5d 29 29 0a 28 66 |DLL NODE|."])).(f|
|000003e0| 73 65 74 20 27 64 6c 6c | 2d 63 72 65 61 74 65 20 |set 'dll|-create |
|000003f0| 23 5b 6e 69 6c 20 22 c0 | c1 89 89 23 89 1a c3 5c |#[nil ".|...#...\|
|00000400| 6e 49 88 5c 6e c4 5c 6e | 49 88 c5 5c 6e 29 42 87 |nI.\n.\n|I..\n)B.|
|00000410| 22 20 5b 76 65 63 74 6f | 72 20 6e 69 6c 20 64 75 |" [vecto|r nil du|
|00000420| 6d 6d 79 2d 6e 6f 64 65 | 20 31 20 30 20 44 4c 2d |mmy-node| 1 0 DL-|
|00000430| 4c 49 53 54 5d 20 35 20 | 22 5c 0a 43 72 65 61 74 |LIST] 5 |"\.Creat|
|00000440| 65 20 61 6e 20 65 6d 70 | 74 79 20 64 6f 75 62 6c |e an emp|ty doubl|
|00000450| 79 20 6c 69 6e 6b 65 64 | 20 6c 69 73 74 2e 22 5d |y linked| list."]|
|00000460| 29 0a 28 66 73 65 74 20 | 27 64 6c 6c 2d 70 20 23 |).(fset |'dll-p #|
|00000470| 5b 28 6f 62 6a 65 63 74 | 29 20 22 08 a2 c1 3d 87 |[(object|) "...=.|
|00000480| 22 20 5b 6f 62 6a 65 63 | 74 20 44 4c 2d 4c 49 53 |" [objec|t DL-LIS|
|00000490| 54 5d 20 32 20 22 5c 0a | 52 65 74 75 72 6e 20 74 |T] 2 "\.|Return t|
|000004a0| 20 69 66 20 4f 42 4a 45 | 43 54 20 69 73 20 61 20 | if OBJE|CT is a |
|000004b0| 64 6f 75 62 6c 79 20 6c | 69 6e 6b 65 64 20 6c 69 |doubly l|inked li|
|000004c0| 73 74 2c 20 6f 74 68 65 | 72 77 69 73 65 20 72 65 |st, othe|rwise re|
|000004d0| 74 75 72 6e 20 6e 69 6c | 2e 22 5d 29 0a 28 66 73 |turn nil|."]).(fs|
|000004e0| 65 74 20 27 64 6c 6c 2d | 65 6e 74 65 72 2d 66 69 |et 'dll-|enter-fi|
|000004f0| 72 73 74 20 23 5b 28 64 | 6c 6c 20 65 6c 65 6d 65 |rst #[(d|ll eleme|
|00000500| 6e 74 29 20 22 c0 09 c2 | 09 21 0b 23 87 22 20 5b |nt) "...|.!.#." [|
|00000510| 64 6c 6c 2d 65 6e 74 65 | 72 2d 61 66 74 65 72 20 |dll-ente|r-after |
|00000520| 64 6c 6c 20 64 6c 6c 2d | 67 65 74 2d 64 75 6d 6d |dll dll-|get-dumm|
|00000530| 79 2d 6e 6f 64 65 20 65 | 6c 65 6d 65 6e 74 5d 20 |y-node e|lement] |
|00000540| 34 20 22 5c 0a 41 64 64 | 20 61 6e 20 65 6c 65 6d |4 "\.Add| an elem|
|00000550| 65 6e 74 20 66 69 72 73 | 74 20 6f 6e 20 61 20 64 |ent firs|t on a d|
|00000560| 6f 75 62 6c 79 20 6c 69 | 6e 6b 65 64 20 6c 69 73 |oubly li|nked lis|
|00000570| 74 2e 0a 41 72 67 73 3a | 20 44 4c 4c 20 45 4c 45 |t..Args:| DLL ELE|
|00000580| 4d 45 4e 54 2e 22 5d 29 | 0a 28 66 73 65 74 20 27 |MENT."])|.(fset '|
|00000590| 64 6c 6c 2d 65 6e 74 65 | 72 2d 6c 61 73 74 20 23 |dll-ente|r-last #|
|000005a0| 5b 28 64 6c 6c 20 65 6c | 65 6d 65 6e 74 29 20 22 |[(dll el|ement) "|
|000005b0| c0 09 c2 09 21 0b 23 87 | 22 20 5b 64 6c 6c 2d 65 |....!.#.|" [dll-e|
|000005c0| 6e 74 65 72 2d 62 65 66 | 6f 72 65 20 64 6c 6c 20 |nter-bef|ore dll |
|000005d0| 64 6c 6c 2d 67 65 74 2d | 64 75 6d 6d 79 2d 6e 6f |dll-get-|dummy-no|
|000005e0| 64 65 20 65 6c 65 6d 65 | 6e 74 5d 20 34 20 22 5c |de eleme|nt] 4 "\|
|000005f0| 0a 41 64 64 20 61 6e 20 | 65 6c 65 6d 65 6e 74 20 |.Add an |element |
|00000600| 6c 61 73 74 20 6f 6e 20 | 61 20 64 6f 75 62 6c 79 |last on |a doubly|
|00000610| 20 6c 69 6e 6b 65 64 20 | 6c 69 73 74 2e 0a 41 72 | linked |list..Ar|
|00000620| 67 73 3a 20 44 4c 4c 20 | 45 4c 45 4d 45 4e 54 2e |gs: DLL |ELEMENT.|
|00000630| 22 5d 29 0a 28 66 73 65 | 74 20 27 64 6c 6c 2d 65 |"]).(fse|t 'dll-e|
|00000640| 6e 74 65 72 2d 61 66 74 | 65 72 20 23 5b 28 64 6c |nter-aft|er #[(dl|
|00000650| 6c 20 6e 6f 64 65 20 65 | 6c 65 6d 65 6e 74 29 20 |l node e|lement) |
|00000660| 22 c0 09 89 c2 48 0b 23 | 1c 09 c2 48 c5 0c 49 88 |"....H.#|...H..I.|
|00000670| 09 c2 0c 49 29 87 22 20 | 5b 76 65 63 74 6f 72 20 |...I)." |[vector |
|00000680| 6e 6f 64 65 20 31 20 65 | 6c 65 6d 65 6e 74 20 6e |node 1 e|lement n|
|00000690| 65 77 2d 6e 6f 64 65 20 | 30 5d 20 34 20 22 5c 0a |ew-node |0] 4 "\.|
|000006a0| 49 6e 20 74 68 65 20 64 | 6f 75 62 6c 79 20 6c 69 |In the d|oubly li|
|000006b0| 6e 6b 65 64 20 6c 69 73 | 74 20 44 4c 4c 2c 20 69 |nked lis|t DLL, i|
|000006c0| 6e 73 65 72 74 20 61 20 | 6e 6f 64 65 20 63 6f 6e |nsert a |node con|
|000006d0| 74 61 69 6e 69 6e 67 20 | 45 4c 45 4d 45 4e 54 20 |taining |ELEMENT |
|000006e0| 61 66 74 65 72 20 4e 4f | 44 45 2e 0a 41 72 67 73 |after NO|DE..Args|
|000006f0| 3a 20 44 4c 4c 20 4e 4f | 44 45 20 45 4c 45 4d 45 |: DLL NO|DE ELEME|
|00000700| 4e 54 2e 22 5d 29 0a 28 | 66 73 65 74 20 27 64 6c |NT."]).(|fset 'dl|
|00000710| 6c 2d 65 6e 74 65 72 2d | 62 65 66 6f 72 65 20 23 |l-enter-|before #|
|00000720| 5b 28 64 6c 6c 20 6e 6f | 64 65 20 65 6c 65 6d 65 |[(dll no|de eleme|
|00000730| 6e 74 29 20 22 c0 09 c2 | 48 09 0b 23 1c 09 c2 48 |nt) "...|H..#...H|
|00000740| c5 0c 49 88 09 c2 0c 49 | 29 87 22 20 5b 76 65 63 |..I....I|)." [vec|
|00000750| 74 6f 72 20 6e 6f 64 65 | 20 30 20 65 6c 65 6d 65 |tor node| 0 eleme|
|00000760| 6e 74 20 6e 65 77 2d 6e | 6f 64 65 20 31 5d 20 34 |nt new-n|ode 1] 4|
|00000770| 20 22 5c 0a 49 6e 20 74 | 68 65 20 64 6f 75 62 6c | "\.In t|he doubl|
|00000780| 79 20 6c 69 6e 6b 65 64 | 20 6c 69 73 74 20 44 4c |y linked| list DL|
|00000790| 4c 2c 20 69 6e 73 65 72 | 74 20 61 20 6e 6f 64 65 |L, inser|t a node|
|000007a0| 20 63 6f 6e 74 61 69 6e | 69 6e 67 20 45 4c 45 4d | contain|ing ELEM|
|000007b0| 45 4e 54 20 62 65 66 6f | 72 65 20 4e 4f 44 45 2e |ENT befo|re NODE.|
|000007c0| 0a 41 72 67 73 3a 20 44 | 4c 4c 20 4e 4f 44 45 20 |.Args: D|LL NODE |
|000007d0| 45 4c 45 4d 45 4e 54 2e | 22 5d 29 0a 28 66 73 65 |ELEMENT.|"]).(fse|
|000007e0| 74 20 27 64 6c 6c 2d 6e | 65 78 74 20 23 5b 28 64 |t 'dll-n|ext #[(d|
|000007f0| 6c 6c 20 6e 6f 64 65 29 | 20 22 08 c1 48 c2 0b 21 |ll node)| "..H..!|
|00000800| 3d 3f ad 83 08 c1 48 87 | 22 20 5b 6e 6f 64 65 20 |=?....H.|" [node |
|00000810| 31 20 64 6c 6c 2d 67 65 | 74 2d 64 75 6d 6d 79 2d |1 dll-ge|t-dummy-|
|00000820| 6e 6f 64 65 20 64 6c 6c | 5d 20 33 20 22 5c 0a 52 |node dll|] 3 "\.R|
|00000830| 65 74 75 72 6e 20 74 68 | 65 20 6e 6f 64 65 20 61 |eturn th|e node a|
|00000840| 66 74 65 72 20 4e 4f 44 | 45 2c 20 6f 72 20 6e 69 |fter NOD|E, or ni|
|00000850| 6c 20 69 66 20 4e 4f 44 | 45 20 69 73 20 74 68 65 |l if NOD|E is the|
|00000860| 20 6c 61 73 74 20 6e 6f | 64 65 2e 0a 41 72 67 73 | last no|de..Args|
|00000870| 3a 20 44 4c 4c 20 4e 4f | 44 45 2e 22 5d 29 0a 28 |: DLL NO|DE."]).(|
|00000880| 66 73 65 74 20 27 64 6c | 6c 2d 70 72 65 76 69 6f |fset 'dl|l-previo|
|00000890| 75 73 20 23 5b 28 64 6c | 6c 20 6e 6f 64 65 29 20 |us #[(dl|l node) |
|000008a0| 22 08 c1 48 c2 0b 21 3d | 3f ad 83 08 c1 48 87 22 |"..H..!=|?....H."|
|000008b0| 20 5b 6e 6f 64 65 20 30 | 20 64 6c 6c 2d 67 65 74 | [node 0| dll-get|
|000008c0| 2d 64 75 6d 6d 79 2d 6e | 6f 64 65 20 64 6c 6c 5d |-dummy-n|ode dll]|
|000008d0| 20 33 20 22 5c 0a 52 65 | 74 75 72 6e 20 74 68 65 | 3 "\.Re|turn the|
|000008e0| 20 6e 6f 64 65 20 62 65 | 66 6f 72 65 20 4e 4f 44 | node be|fore NOD|
|000008f0| 45 2c 20 6f 72 20 6e 69 | 6c 20 69 66 20 4e 4f 44 |E, or ni|l if NOD|
|00000900| 45 20 69 73 20 74 68 65 | 20 66 69 72 73 74 20 6e |E is the| first n|
|00000910| 6f 64 65 2e 0a 41 72 67 | 73 3a 20 44 4c 4c 20 4e |ode..Arg|s: DLL N|
|00000920| 4f 44 45 2e 22 5d 29 0a | 28 66 73 65 74 20 27 64 |ODE."]).|(fset 'd|
|00000930| 6c 6c 2d 64 65 6c 65 74 | 65 20 23 5b 28 64 6c 6c |ll-delet|e #[(dll|
|00000940| 20 6e 6f 64 65 29 20 22 | 08 c1 48 c2 08 c2 48 49 | node) "|..H...HI|
|00000950| 88 08 c2 48 c1 08 c1 48 | 49 88 08 c3 48 87 22 20 |...H...H|I...H." |
|00000960| 5b 6e 6f 64 65 20 30 20 | 31 20 32 5d 20 34 20 22 |[node 0 |1 2] 4 "|
|00000970| 5c 0a 44 65 6c 65 74 65 | 20 4e 4f 44 45 20 66 72 |\.Delete| NODE fr|
|00000980| 6f 6d 20 74 68 65 20 64 | 6f 75 62 6c 79 20 6c 69 |om the d|oubly li|
|00000990| 6e 6b 65 64 20 6c 69 73 | 74 20 44 4c 4c 2e 0a 41 |nked lis|t DLL..A|
|000009a0| 72 67 73 3a 20 44 4c 4c | 20 4e 4f 44 45 2e 20 52 |rgs: DLL| NODE. R|
|000009b0| 65 74 75 72 6e 20 74 68 | 65 20 65 6c 65 6d 65 6e |eturn th|e elemen|
|000009c0| 74 20 6f 66 20 6e 6f 64 | 65 2e 22 5d 29 0a 28 66 |t of nod|e."]).(f|
|000009d0| 73 65 74 20 27 64 6c 6c | 2d 64 65 6c 65 74 65 2d |set 'dll|-delete-|
|000009e0| 66 69 72 73 74 20 23 5b | 28 64 6c 6c 29 20 22 c0 |first #[|(dll) ".|
|000009f0| 09 c2 09 21 c3 48 5c 22 | 87 22 20 5b 64 6c 6c 2d |...!.H\"|." [dll-|
|00000a00| 64 65 6c 65 74 65 20 64 | 6c 6c 20 64 6c 6c 2d 67 |delete d|ll dll-g|
|00000a10| 65 74 2d 64 75 6d 6d 79 | 2d 6e 6f 64 65 20 31 5d |et-dummy|-node 1]|
|00000a20| 20 34 20 22 5c 0a 44 65 | 6c 65 74 65 20 74 68 65 | 4 "\.De|lete the|
|00000a30| 20 66 69 72 73 74 20 4e | 4f 44 45 20 66 72 6f 6d | first N|ODE from|
|00000a40| 20 74 68 65 20 64 6f 75 | 62 6c 79 20 6c 69 6e 6b | the dou|bly link|
|00000a50| 65 64 20 6c 69 73 74 20 | 44 4c 4c 2e 0a 52 65 74 |ed list |DLL..Ret|
|00000a60| 75 72 6e 20 74 68 65 20 | 65 6c 65 6d 65 6e 74 2e |urn the |element.|
|00000a70| 20 41 72 67 73 3a 20 44 | 4c 4c 2e 20 52 65 74 75 | Args: D|LL. Retu|
|00000a80| 72 6e 73 20 6e 69 6c 20 | 69 66 20 74 68 65 20 44 |rns nil |if the D|
|00000a90| 4c 4c 20 77 61 73 20 65 | 6d 70 74 79 2e 22 5d 29 |LL was e|mpty."])|
|00000aa0| 0a 28 66 73 65 74 20 27 | 64 6c 6c 2d 64 65 6c 65 |.(fset '|dll-dele|
|00000ab0| 74 65 2d 6c 61 73 74 20 | 23 5b 28 64 6c 6c 29 20 |te-last |#[(dll) |
|00000ac0| 22 c0 09 c2 09 21 c3 48 | 5c 22 87 22 20 5b 64 6c |"....!.H|\"." [dl|
|00000ad0| 6c 2d 64 65 6c 65 74 65 | 20 64 6c 6c 20 64 6c 6c |l-delete| dll dll|
|00000ae0| 2d 67 65 74 2d 64 75 6d | 6d 79 2d 6e 6f 64 65 20 |-get-dum|my-node |
|00000af0| 30 5d 20 34 20 22 5c 0a | 44 65 6c 65 74 65 20 74 |0] 4 "\.|Delete t|
|00000b00| 68 65 20 6c 61 73 74 20 | 4e 4f 44 45 20 66 72 6f |he last |NODE fro|
|00000b10| 6d 20 74 68 65 20 64 6f | 75 62 6c 79 20 6c 69 6e |m the do|ubly lin|
|00000b20| 6b 65 64 20 6c 69 73 74 | 20 44 4c 4c 2e 0a 52 65 |ked list| DLL..Re|
|00000b30| 74 75 72 6e 20 74 68 65 | 20 65 6c 65 6d 65 6e 74 |turn the| element|
|00000b40| 2e 20 41 72 67 73 3a 20 | 44 4c 4c 2e 20 52 65 74 |. Args: |DLL. Ret|
|00000b50| 75 72 6e 73 20 6e 69 6c | 20 69 66 20 74 68 65 20 |urns nil| if the |
|00000b60| 44 4c 4c 20 77 61 73 20 | 65 6d 70 74 79 2e 22 5d |DLL was |empty."]|
|00000b70| 29 0a 28 66 73 65 74 20 | 27 64 6c 6c 2d 66 69 72 |).(fset |'dll-fir|
|00000b80| 73 74 20 23 5b 28 64 6c | 6c 29 20 22 c0 09 21 c2 |st #[(dl|l) "..!.|
|00000b90| 48 c0 09 21 3d 3f ad 87 | c0 09 21 c2 48 c3 48 87 |H..!=?..|..!.H.H.|
|00000ba0| 22 20 5b 64 6c 6c 2d 67 | 65 74 2d 64 75 6d 6d 79 |" [dll-g|et-dummy|
|00000bb0| 2d 6e 6f 64 65 20 64 6c | 6c 20 31 20 32 5d 20 33 |-node dl|l 1 2] 3|
|00000bc0| 20 22 5c 0a 52 65 74 75 | 72 6e 20 74 68 65 20 66 | "\.Retu|rn the f|
|00000bd0| 69 72 73 74 20 65 6c 65 | 6d 65 6e 74 20 6f 6e 20 |irst ele|ment on |
|00000be0| 74 68 65 20 64 6f 75 62 | 6c 79 20 6c 69 6e 6b 65 |the doub|ly linke|
|00000bf0| 64 20 6c 69 73 74 20 44 | 4c 4c 2e 0a 52 65 74 75 |d list D|LL..Retu|
|00000c00| 72 6e 20 6e 69 6c 20 69 | 66 20 74 68 65 20 6c 69 |rn nil i|f the li|
|00000c10| 73 74 20 69 73 20 65 6d | 70 74 79 2e 20 54 68 65 |st is em|pty. The|
|00000c20| 20 65 6c 65 6d 65 6e 74 | 20 69 73 20 6e 6f 74 20 | element| is not |
|00000c30| 72 65 6d 6f 76 65 64 2e | 22 5d 29 0a 28 66 73 65 |removed.|"]).(fse|
|00000c40| 74 20 27 64 6c 6c 2d 6c | 61 73 74 20 23 5b 28 64 |t 'dll-l|ast #[(d|
|00000c50| 6c 6c 29 20 22 c0 09 21 | c2 48 c0 09 21 3d 3f ad |ll) "..!|.H..!=?.|
|00000c60| 87 c0 09 21 c2 48 c3 48 | 87 22 20 5b 64 6c 6c 2d |...!.H.H|." [dll-|
|00000c70| 67 65 74 2d 64 75 6d 6d | 79 2d 6e 6f 64 65 20 64 |get-dumm|y-node d|
|00000c80| 6c 6c 20 30 20 32 5d 20 | 33 20 22 5c 0a 52 65 74 |ll 0 2] |3 "\.Ret|
|00000c90| 75 72 6e 20 74 68 65 20 | 6c 61 73 74 20 65 6c 65 |urn the |last ele|
|00000ca0| 6d 65 6e 74 20 6f 6e 20 | 74 68 65 20 64 6f 75 62 |ment on |the doub|
|00000cb0| 6c 79 20 6c 69 6e 6b 65 | 64 20 6c 69 73 74 20 44 |ly linke|d list D|
|00000cc0| 4c 4c 2e 0a 52 65 74 75 | 72 6e 20 6e 69 6c 20 69 |LL..Retu|rn nil i|
|00000cd0| 66 20 74 68 65 20 6c 69 | 73 74 20 69 73 20 65 6d |f the li|st is em|
|00000ce0| 70 74 79 2e 20 54 68 65 | 20 65 6c 65 6d 65 6e 74 |pty. The| element|
|00000cf0| 20 69 73 20 6e 6f 74 20 | 72 65 6d 6f 76 65 64 2e | is not |removed.|
|00000d00| 22 5d 29 0a 28 66 73 65 | 74 20 27 64 6c 6c 2d 6e |"]).(fse|t 'dll-n|
|00000d10| 74 68 20 23 5b 28 64 6c | 6c 20 6e 29 20 22 c0 09 |th #[(dl|l n) "..|
|00000d20| 21 1a 0b c4 57 ab 83 c4 | aa 81 c5 1e 06 5c 6e 0e |!...W...|.....\n.|
|00000d30| 06 48 1e 07 0b c4 57 ab | 84 c8 0b 5a 13 5c 6e 0e |.H....W.|...Z.\n.|
|00000d40| 07 3d ac 91 0b c4 56 ab | 8c 0e 07 0e 06 48 16 07 |.=....V.|.....H..|
|00000d50| 0b 53 13 aa 69 5c 6e 0e | 07 3d 3f ad 82 0e 07 2b |.S..i\n.|.=?....+|
|00000d60| 87 22 20 5b 64 6c 6c 2d | 67 65 74 2d 64 75 6d 6d |." [dll-|get-dumm|
|00000d70| 79 2d 6e 6f 64 65 20 64 | 6c 6c 20 64 75 6d 6d 79 |y-node d|ll dummy|
|00000d80| 20 6e 20 30 20 31 20 62 | 72 61 6e 63 68 20 6e 6f | n 0 1 b|ranch no|
|00000d90| 64 65 20 2d 31 5d 20 32 | 20 22 5c 0a 52 65 74 75 |de -1] 2| "\.Retu|
|00000da0| 72 6e 20 74 68 65 20 4e | 74 68 20 6e 6f 64 65 20 |rn the N|th node |
|00000db0| 66 72 6f 6d 20 74 68 65 | 20 64 6f 75 62 6c 79 20 |from the| doubly |
|00000dc0| 6c 69 6e 6b 65 64 20 6c | 69 73 74 20 44 4c 4c 2e |linked l|ist DLL.|
|00000dd0| 0a 20 41 72 67 73 3a 20 | 44 4c 4c 20 4e 0a 4e 20 |. Args: |DLL N.N |
|00000de0| 63 6f 75 6e 74 73 20 66 | 72 6f 6d 20 7a 65 72 6f |counts f|rom zero|
|00000df0| 2e 20 49 66 20 44 4c 4c | 20 69 73 20 6e 6f 74 20 |. If DLL| is not |
|00000e00| 74 68 61 74 20 6c 6f 6e | 67 2c 20 6e 69 6c 20 69 |that lon|g, nil i|
|00000e10| 73 20 72 65 74 75 72 6e | 65 64 2e 0a 49 66 20 4e |s return|ed..If N|
|00000e20| 20 69 73 20 6e 65 67 61 | 74 69 76 65 2c 20 72 65 | is nega|tive, re|
|00000e30| 74 75 72 6e 20 74 68 65 | 20 2d 28 4e 2b 31 29 74 |turn the| -(N+1)t|
|00000e40| 68 20 6c 61 73 74 20 65 | 6c 65 6d 65 6e 74 2e 0a |h last e|lement..|
|00000e50| 54 68 75 73 2c 20 28 64 | 6c 6c 2d 6e 74 68 20 64 |Thus, (d|ll-nth d|
|00000e60| 6c 6c 20 30 29 20 72 65 | 74 75 72 6e 73 20 74 68 |ll 0) re|turns th|
|00000e70| 65 20 66 69 72 73 74 20 | 6e 6f 64 65 2c 0a 61 6e |e first |node,.an|
|00000e80| 64 20 28 64 6c 6c 2d 6e | 74 68 20 64 6c 6c 20 2d |d (dll-n|th dll -|
|00000e90| 31 29 20 72 65 74 75 72 | 6e 73 20 74 68 65 20 6c |1) retur|ns the l|
|00000ea0| 61 73 74 20 6e 6f 64 65 | 2e 22 5d 29 0a 28 66 73 |ast node|."]).(fs|
|00000eb0| 65 74 20 27 64 6c 6c 2d | 65 6d 70 74 79 20 23 5b |et 'dll-|empty #[|
|00000ec0| 28 64 6c 6c 29 20 22 c0 | 09 21 c2 48 c0 09 21 3d |(dll) ".|.!.H..!=|
|00000ed0| 87 22 20 5b 64 6c 6c 2d | 67 65 74 2d 64 75 6d 6d |." [dll-|get-dumm|
|00000ee0| 79 2d 6e 6f 64 65 20 64 | 6c 6c 20 30 5d 20 33 20 |y-node d|ll 0] 3 |
|00000ef0| 22 5c 0a 52 65 74 75 72 | 6e 20 74 20 69 66 20 74 |"\.Retur|n t if t|
|00000f00| 68 65 20 64 6f 75 62 6c | 79 20 6c 69 6e 6b 65 64 |he doubl|y linked|
|00000f10| 20 6c 69 73 74 20 44 4c | 4c 20 69 73 20 65 6d 70 | list DL|L is emp|
|00000f20| 74 79 2c 20 6e 69 6c 20 | 6f 74 68 65 72 77 69 73 |ty, nil |otherwis|
|00000f30| 65 22 5d 29 0a 28 66 73 | 65 74 20 27 64 6c 6c 2d |e"]).(fs|et 'dll-|
|00000f40| 6c 65 6e 67 74 68 20 23 | 5b 28 64 6c 6c 29 20 22 |length #|[(dll) "|
|00000f50| c0 09 21 89 1a c3 48 1c | c5 1e 06 0c 5c 6e 3d ac |..!...H.|....\n=.|
|00000f60| 8b 0c c3 48 14 0e 06 54 | 16 06 aa 70 0e 06 2b 87 |...H...T|...p..+.|
|00000f70| 22 20 5b 64 6c 6c 2d 67 | 65 74 2d 64 75 6d 6d 79 |" [dll-g|et-dummy|
|00000f80| 2d 6e 6f 64 65 20 64 6c | 6c 20 64 75 6d 6d 79 20 |-node dl|l dummy |
|00000f90| 31 20 6e 6f 64 65 20 30 | 20 6e 5d 20 33 20 22 5c |1 node 0| n] 3 "\|
|00000fa0| 0a 52 65 74 75 72 6e 73 | 20 74 68 65 20 6e 75 6d |.Returns| the num|
|00000fb0| 62 65 72 20 6f 66 20 65 | 6c 65 6d 65 6e 74 73 20 |ber of e|lements |
|00000fc0| 69 6e 20 74 68 65 20 64 | 6f 75 62 6c 79 20 6c 69 |in the d|oubly li|
|00000fd0| 6e 6b 65 64 20 6c 69 73 | 74 20 44 4c 4c 2e 22 5d |nked lis|t DLL."]|
|00000fe0| 29 0a 28 66 73 65 74 20 | 27 64 6c 6c 2d 63 6f 70 |).(fset |'dll-cop|
|00000ff0| 79 20 23 5b 28 64 6c 6c | 20 26 6f 70 74 69 6f 6e |y #[(dll| &option|
|00001000| 61 6c 20 65 6c 65 6d 65 | 6e 74 2d 63 6f 70 79 2d |al eleme|nt-copy-|
|00001010| 66 6e 63 29 20 22 c0 20 | c1 5c 6e c3 5c 22 1c 1d |fnc) ". |.\n.\"..|
|00001020| 0e 06 ab 95 0c ab a4 c7 | 0d 0e 06 0c c8 48 21 5c |........|.....H!\|
|00001030| 22 88 c9 5c 6e 0c 5c 22 | 89 14 aa 6c 0c ab 8f c7 |"..\n.\"|...l....|
|00001040| 0d 0c c8 48 5c 22 88 c9 | 5c 6e 0c 5c 22 89 14 ac |...H\"..|\n.\"...|
|00001050| 71 0d 2a 87 22 20 5b 64 | 6c 6c 2d 63 72 65 61 74 |q.*." [d|ll-creat|
|00001060| 65 20 64 6c 6c 2d 6e 74 | 68 20 64 6c 6c 20 30 20 |e dll-nt|h dll 0 |
|00001070| 6e 6f 64 65 20 72 65 73 | 75 6c 74 20 65 6c 65 6d |node res|ult elem|
|00001080| 65 6e 74 2d 63 6f 70 79 | 2d 66 6e 63 20 64 6c 6c |ent-copy|-fnc dll|
|00001090| 2d 65 6e 74 65 72 2d 6c | 61 73 74 20 32 20 64 6c |-enter-l|ast 2 dl|
|000010a0| 6c 2d 6e 65 78 74 5d 20 | 36 20 22 5c 0a 52 65 74 |l-next] |6 "\.Ret|
|000010b0| 75 72 6e 20 61 20 63 6f | 70 79 20 6f 66 20 74 68 |urn a co|py of th|
|000010c0| 65 20 64 6f 75 62 6c 79 | 20 6c 69 6e 6b 65 64 20 |e doubly| linked |
|000010d0| 6c 69 73 74 20 44 4c 4c | 2e 0a 49 66 20 6f 70 74 |list DLL|..If opt|
|000010e0| 69 6f 6e 61 6c 20 73 65 | 63 6f 6e 64 20 61 72 67 |ional se|cond arg|
|000010f0| 75 6d 65 6e 74 20 45 4c | 45 4d 45 4e 54 2d 43 4f |ument EL|EMENT-CO|
|00001100| 50 59 2d 46 4e 43 20 69 | 73 20 6e 6f 6e 2d 6e 69 |PY-FNC i|s non-ni|
|00001110| 6c 20 69 74 20 73 68 6f | 75 6c 64 20 62 65 0a 61 |l it sho|uld be.a|
|00001120| 20 66 75 6e 63 74 69 6f | 6e 20 74 68 61 74 20 74 | functio|n that t|
|00001130| 61 6b 65 73 20 6f 6e 65 | 20 61 72 67 75 6d 65 6e |akes one| argumen|
|00001140| 74 2c 20 61 6e 20 65 6c | 65 6d 65 6e 74 2c 20 61 |t, an el|ement, a|
|00001150| 6e 64 20 72 65 74 75 72 | 6e 73 20 61 20 63 6f 70 |nd retur|ns a cop|
|00001160| 79 20 6f 66 20 69 74 2e | 0a 49 66 20 45 4c 45 4d |y of it.|.If ELEM|
|00001170| 45 4e 54 2d 43 4f 50 59 | 2d 46 4e 43 20 69 73 20 |ENT-COPY|-FNC is |
|00001180| 6e 6f 74 20 67 69 76 65 | 6e 20 74 68 65 20 65 6c |not give|n the el|
|00001190| 65 6d 65 6e 74 73 20 61 | 72 65 20 6e 6f 74 20 63 |ements a|re not c|
|000011a0| 6f 70 69 65 64 2e 22 5d | 29 0a 28 66 73 65 74 20 |opied."]|).(fset |
|000011b0| 27 64 6c 6c 2d 61 6c 6c | 20 23 5b 28 64 6c 6c 29 |'dll-all| #[(dll)|
|000011c0| 20 22 c0 19 c2 0b 21 89 | 1c c5 48 89 1e 06 0c 3d | "....!.|..H....=|
|000011d0| ac 90 0e 06 c7 48 09 42 | 11 0e 06 c5 48 89 16 06 |.....H.B|....H...|
|000011e0| aa 6c 09 2b 87 22 20 5b | 6e 69 6c 20 72 65 73 75 |.l.+." [|nil resu|
|000011f0| 6c 74 20 64 6c 6c 2d 67 | 65 74 2d 64 75 6d 6d 79 |lt dll-g|et-dummy|
|00001200| 2d 6e 6f 64 65 20 64 6c | 6c 20 64 75 6d 6d 79 20 |-node dl|l dummy |
|00001210| 30 20 6e 6f 64 65 20 32 | 5d 20 33 20 22 5c 0a 52 |0 node 2|] 3 "\.R|
|00001220| 65 74 75 72 6e 20 61 6c | 6c 20 65 6c 65 6d 65 6e |eturn al|l elemen|
|00001230| 74 73 20 6f 6e 20 74 68 | 65 20 64 6f 75 62 6c 65 |ts on th|e double|
|00001240| 20 6c 69 6e 6b 65 64 20 | 6c 69 73 74 20 44 4c 4c | linked |list DLL|
|00001250| 20 61 73 20 61 6e 20 6f | 72 64 69 6e 61 72 79 20 | as an o|rdinary |
|00001260| 6c 69 73 74 2e 22 5d 29 | 0a 28 66 73 65 74 20 27 |list."])|.(fset '|
|00001270| 64 6c 6c 2d 63 6c 65 61 | 72 20 23 5b 28 64 6c 6c |dll-clea|r #[(dll|
|00001280| 29 20 22 c0 09 21 c2 c0 | 09 21 49 88 c0 09 21 c3 |) "..!..|.!I...!.|
|00001290| c0 09 21 49 87 22 20 5b | 64 6c 6c 2d 67 65 74 2d |..!I." [|dll-get-|
|000012a0| 64 75 6d 6d 79 2d 6e 6f | 64 65 20 64 6c 6c 20 30 |dummy-no|de dll 0|
|000012b0| 20 31 5d 20 34 20 22 5c | 0a 43 6c 65 61 72 20 74 | 1] 4 "\|.Clear t|
|000012c0| 68 65 20 64 6f 75 62 6c | 79 20 6c 69 6e 6b 65 64 |he doubl|y linked|
|000012d0| 20 6c 69 73 74 20 44 4c | 4c 2c 20 69 2e 65 2e 20 | list DL|L, i.e. |
|000012e0| 6d 61 6b 65 20 69 74 20 | 63 6f 6d 70 6c 65 74 65 |make it |complete|
|000012f0| 6c 79 20 65 6d 70 74 79 | 2e 22 5d 29 0a 28 66 73 |ly empty|."]).(fs|
|00001300| 65 74 20 27 64 6c 6c 2d | 6d 61 70 20 23 5b 28 6d |et 'dll-|map #[(m|
|00001310| 61 70 2d 66 75 6e 63 74 | 69 6f 6e 20 64 6c 6c 29 |ap-funct|ion dll)|
|00001320| 20 22 c0 09 21 89 1a c3 | 48 89 1c 5c 6e 3d 3f ad | "..!...|H..\n=?.|
|00001330| 8d 0d 0c c6 48 21 88 0c | c3 48 89 14 aa 6e 2a 87 |....H!..|.H...n*.|
|00001340| 22 20 5b 64 6c 6c 2d 67 | 65 74 2d 64 75 6d 6d 79 |" [dll-g|et-dummy|
|00001350| 2d 6e 6f 64 65 20 64 6c | 6c 20 64 75 6d 6d 79 20 |-node dl|l dummy |
|00001360| 31 20 6e 6f 64 65 20 6d | 61 70 2d 66 75 6e 63 74 |1 node m|ap-funct|
|00001370| 69 6f 6e 20 32 5d 20 34 | 20 22 5c 0a 41 70 70 6c |ion 2] 4| "\.Appl|
|00001380| 79 20 4d 41 50 2d 46 55 | 4e 43 54 49 4f 4e 20 74 |y MAP-FU|NCTION t|
|00001390| 6f 20 61 6c 6c 20 65 6c | 65 6d 65 6e 74 73 20 69 |o all el|ements i|
|000013a0| 6e 20 74 68 65 20 64 6f | 75 62 6c 79 20 6c 69 6e |n the do|ubly lin|
|000013b0| 6b 65 64 20 6c 69 73 74 | 20 44 4c 4c 2e 0a 54 68 |ked list| DLL..Th|
|000013c0| 65 20 66 75 6e 63 74 69 | 6f 6e 20 69 73 20 61 70 |e functi|on is ap|
|000013d0| 70 6c 69 65 64 20 74 6f | 20 74 68 65 20 66 69 72 |plied to| the fir|
|000013e0| 73 74 20 65 6c 65 6d 65 | 6e 74 20 66 69 72 73 74 |st eleme|nt first|
|000013f0| 2e 22 5d 29 0a 28 66 73 | 65 74 20 27 64 6c 6c 2d |."]).(fs|et 'dll-|
|00001400| 6d 61 70 2d 72 65 76 65 | 72 73 65 20 23 5b 28 6d |map-reve|rse #[(m|
|00001410| 61 70 2d 66 75 6e 63 74 | 69 6f 6e 20 64 6c 6c 29 |ap-funct|ion dll)|
|00001420| 20 22 c0 09 21 89 1a c3 | 48 89 1c 5c 6e 3d 3f ad | "..!...|H..\n=?.|
|00001430| 8d 0d 0c c6 48 21 88 0c | c3 48 89 14 aa 6e 2a 87 |....H!..|.H...n*.|
|00001440| 22 20 5b 64 6c 6c 2d 67 | 65 74 2d 64 75 6d 6d 79 |" [dll-g|et-dummy|
|00001450| 2d 6e 6f 64 65 20 64 6c | 6c 20 64 75 6d 6d 79 20 |-node dl|l dummy |
|00001460| 30 20 6e 6f 64 65 20 6d | 61 70 2d 66 75 6e 63 74 |0 node m|ap-funct|
|00001470| 69 6f 6e 20 32 5d 20 34 | 20 22 5c 0a 41 70 70 6c |ion 2] 4| "\.Appl|
|00001480| 79 20 4d 41 50 2d 46 55 | 4e 43 54 49 4f 4e 20 74 |y MAP-FU|NCTION t|
|00001490| 6f 20 61 6c 6c 20 65 6c | 65 6d 65 6e 74 73 20 69 |o all el|ements i|
|000014a0| 6e 20 74 68 65 20 64 6f | 75 62 6c 79 20 6c 69 6e |n the do|ubly lin|
|000014b0| 6b 65 64 20 6c 69 73 74 | 20 44 4c 4c 2e 0a 54 68 |ked list| DLL..Th|
|000014c0| 65 20 66 75 6e 63 74 69 | 6f 6e 20 69 73 20 61 70 |e functi|on is ap|
|000014d0| 70 6c 69 65 64 20 74 6f | 20 74 68 65 20 6c 61 73 |plied to| the las|
|000014e0| 74 20 65 6c 65 6d 65 6e | 74 20 66 69 72 73 74 2e |t elemen|t first.|
|000014f0| 22 5d 29 0a 28 66 73 65 | 74 20 27 64 6c 6c 2d 63 |"]).(fse|t 'dll-c|
|00001500| 72 65 61 74 65 2d 66 72 | 6f 6d 2d 6c 69 73 74 20 |reate-fr|om-list |
|00001510| 23 5b 28 6c 69 73 74 29 | 20 22 c0 20 19 5c 6e ab |#[(list)| ". .\n.|
|00001520| 8c c3 09 5c 6e 40 5c 22 | 88 5c 6e 41 89 12 ac 74 |...\n@\"|.\nA...t|
|00001530| 09 29 87 22 20 5b 64 6c | 6c 2d 63 72 65 61 74 65 |.)." [dl|l-create|
|00001540| 20 64 6c 6c 20 6c 69 73 | 74 20 64 6c 6c 2d 65 6e | dll lis|t dll-en|
|00001550| 74 65 72 2d 6c 61 73 74 | 5d 20 34 20 22 5c 0a 47 |ter-last|] 4 "\.G|
|00001560| 69 76 65 6e 20 61 6e 20 | 65 6c 69 73 70 20 4c 49 |iven an |elisp LI|
|00001570| 53 54 20 63 72 65 61 74 | 65 20 61 20 64 6f 75 62 |ST creat|e a doub|
|00001580| 6c 79 20 6c 69 6e 6b 65 | 64 20 6c 69 73 74 20 77 |ly linke|d list w|
|00001590| 69 74 68 20 74 68 65 20 | 73 61 6d 65 20 65 6c 65 |ith the |same ele|
|000015a0| 6d 65 6e 74 73 2e 22 5d | 29 0a 28 66 73 65 74 20 |ments."]|).(fset |
|000015b0| 27 64 6c 6c 2d 73 6f 72 | 74 20 23 5b 28 64 6c 6c |'dll-sor|t #[(dll|
|000015c0| 20 70 72 65 64 69 63 61 | 74 65 29 20 22 c0 09 c2 | predica|te) "...|
|000015d0| c3 09 21 c4 5c 22 5c 22 | 88 09 87 22 20 5b 64 6c |..!.\"\"|..." [dl|
|000015e0| 6c 2d 73 65 74 2d 66 72 | 6f 6d 2d 6e 6f 64 65 2d |l-set-fr|om-node-|
|000015f0| 6c 69 73 74 20 64 6c 6c | 20 73 6f 72 74 20 64 6c |list dll| sort dl|
|00001600| 6c 2d 6c 69 73 74 2d 6e | 6f 64 65 73 20 23 5b 28 |l-list-n|odes #[(|
|00001610| 78 31 20 78 32 29 20 22 | 08 09 c2 48 0b c2 48 5c |x1 x2) "|...H..H\|
|00001620| 22 87 22 20 5b 70 72 65 | 64 69 63 61 74 65 20 78 |"." [pre|dicate x|
|00001630| 31 20 32 20 78 32 5d 20 | 34 5d 5d 20 35 20 22 5c |1 2 x2] |4]] 5 "\|
|00001640| 0a 53 6f 72 74 20 74 68 | 65 20 64 6f 75 62 6c 79 |.Sort th|e doubly|
|00001650| 20 6c 69 6e 6b 65 64 20 | 6c 69 73 74 20 44 4c 4c | linked |list DLL|
|00001660| 2c 20 73 74 61 62 6c 79 | 2c 20 63 6f 6d 70 61 72 |, stably|, compar|
|00001670| 69 6e 67 20 65 6c 65 6d | 65 6e 74 73 20 75 73 69 |ing elem|ents usi|
|00001680| 6e 67 20 50 52 45 44 49 | 43 41 54 45 2e 0a 52 65 |ng PREDI|CATE..Re|
|00001690| 74 75 72 6e 73 20 74 68 | 65 20 73 6f 72 74 65 64 |turns th|e sorted|
|000016a0| 20 6c 69 73 74 2e 20 44 | 4c 4c 20 69 73 20 6d 6f | list. D|LL is mo|
|000016b0| 64 69 66 69 65 64 20 62 | 79 20 73 69 64 65 20 65 |dified b|y side e|
|000016c0| 66 66 65 63 74 73 2e 0a | 50 52 45 44 49 43 41 54 |ffects..|PREDICAT|
|000016d0| 45 20 69 73 20 63 61 6c | 6c 65 64 20 77 69 74 68 |E is cal|led with|
|000016e0| 20 74 77 6f 20 65 6c 65 | 6d 65 6e 74 73 20 6f 66 | two ele|ments of|
|000016f0| 20 44 4c 4c 2c 20 61 6e | 64 20 73 68 6f 75 6c 64 | DLL, an|d should|
|00001700| 20 72 65 74 75 72 6e 20 | 54 0a 69 66 20 74 68 65 | return |T.if the|
|00001710| 20 66 69 72 73 74 20 65 | 6c 65 6d 65 6e 74 20 69 | first e|lement i|
|00001720| 73 20 5c 22 6c 65 73 73 | 5c 22 20 74 68 61 6e 20 |s \"less|\" than |
|00001730| 74 68 65 20 73 65 63 6f | 6e 64 2e 22 5d 29 0a 28 |the seco|nd."]).(|
|00001740| 66 73 65 74 20 27 64 6c | 6c 2d 66 69 6c 74 65 72 |fset 'dl|l-filter|
|00001750| 20 23 5b 28 64 6c 6c 20 | 70 72 65 64 69 63 61 74 | #[(dll |predicat|
|00001760| 65 29 20 22 c0 09 21 89 | 1a c3 48 1c c5 1e 06 0c |e) "..!.|..H.....|
|00001770| 5c 6e 3d 3f ad 98 0c c3 | 48 16 06 0e 07 0c c8 48 |\n=?....|H......H|
|00001780| 21 ac 85 c9 09 0c 5c 22 | 88 0e 06 89 14 aa 63 2b |!.....\"|......c+|
|00001790| 87 22 20 5b 64 6c 6c 2d | 67 65 74 2d 64 75 6d 6d |." [dll-|get-dumm|
|000017a0| 79 2d 6e 6f 64 65 20 64 | 6c 6c 20 64 75 6d 6d 79 |y-node d|ll dummy|
|000017b0| 20 31 20 6e 6f 64 65 20 | 6e 69 6c 20 6e 65 78 74 | 1 node |nil next|
|000017c0| 20 70 72 65 64 69 63 61 | 74 65 20 32 20 64 6c 6c | predica|te 2 dll|
|000017d0| 2d 64 65 6c 65 74 65 5d | 20 34 20 22 5c 0a 52 65 |-delete]| 4 "\.Re|
|000017e0| 6d 6f 76 65 20 61 6c 6c | 20 65 6c 65 6d 65 6e 74 |move all| element|
|000017f0| 73 20 69 6e 20 74 68 65 | 20 64 6f 75 62 6c 79 20 |s in the| doubly |
|00001800| 6c 69 6e 6b 65 64 20 6c | 69 73 74 20 44 4c 4c 20 |linked l|ist DLL |
|00001810| 66 6f 72 20 77 68 69 63 | 68 20 50 52 45 44 49 43 |for whic|h PREDIC|
|00001820| 41 54 45 0a 72 65 74 75 | 72 6e 20 6e 69 6c 2e 22 |ATE.retu|rn nil."|
|00001830| 5d 29 0a | |]). | |
+--------+-------------------------+-------------------------+--------+--------+