├── .gitignore ├── HISTORY.org ├── README.md ├── backmatter ├── glossary.tex └── solutions.tex ├── book.pdf ├── book.ptc ├── book.tex ├── frontmatter ├── acknow.tex ├── acronym.tex ├── dedic.tex ├── foreword.tex └── preface.tex ├── graphics ├── 02617b75af4d512caf92071211ac3d6a.png ├── 058aad0ea1d9f900745a1e688b75cec8.png ├── 05e249cad1085102aca0ad06c5eb4236.png ├── 06242fdab96c6fc34555b2d3ac36ff56.png ├── 0725da7bdcacd1fcb101173ffeebacae.png ├── 07915cb82d7470aff79636e93397abe3.png ├── 0a1294f5ac71c931e686c647d900fbcb.png ├── 0ae4053de098cc9554752b190a38bc56.png ├── 12595bb2b15b5d8b7263aba68c137db3.png ├── 128px-Negslope.png ├── 128px-Posslope.png ├── 128px-Unfilledcirc.png ├── 14460313caad694cfeab489628009eab.png ├── 1465b5194836899e7331a9fcf9cda03e.png ├── 150px-Triangle.png ├── 180df89d659ad6dc8f29a74fffe1cfb5.png ├── 180px-4bitsadder.png ├── 180px-Galtonbox-Unicon.PNG ├── 180px-Pinstripe-mono-unicon.gif ├── 180px-Pinstripe-mono-unicon.png ├── 180px-Van_der_corput_distribution.png ├── 180px-Xor.png ├── 1a4bfb06a8eb34d1ac09405c02d064c4.png ├── 1a6a1cf8fdc67e4bd31e60a052c3c9ae.png ├── 1b0829cacb50a2b671f2807fe80c911c.png ├── 200px-Intersect.png ├── 200px-Lenna100.jpg ├── 200px-Lenna50.jpg ├── 200px-Plotxy-picoLisp.png ├── 20f99c880facd5566bcaaa82f09c9282.png ├── 225bf69a6a0712ec19f474be5f28bd71.png ├── 250px-Huffman_coding_example.jpg ├── 25e1b8e2f59974728e2a729ad51ba0bd.png ├── 2663fd4ac67a9a044457d845268cd7ce.png ├── 27c40c22beaf5d82e9aabf41eb7d92a2.png ├── 2869715b8204450d9946d9dd1966f50f.png ├── 2958d3ea0159c6ad2ed45f5804fce621.png ├── 2b72903b5dd461c777da13fde57f3ebb.png ├── 2cf603737e11dad8ec4d00dc8298c639.png ├── 2eb0e52a9d4ca2a57f0a0ceaca866399.png ├── 2f17435a71394ce667ab694b27341560.png ├── 31b36ed3111d6cf3e8fa29c9ef59a501.png ├── 33a9aa45fa4dad1deffa8c921462ad74.png ├── 35fc97d739522cf3dc29d28cabc2e717.png ├── 366abde6144a8e6e0d97ba03fd5cde12.png ├── 385714f276153424a4447fa0ede31bf4.png ├── 3bd4ac77a4af3f894d8e88ed7e1ba418.png ├── 3fdf48da32bf746ea787b61406ca05e7.png ├── 409b5a2625bed1a4a6c798323ae1db78.png ├── 411ee43ddd9e5b42c7ef2ddb2ec7e9fb.png ├── 42ca594a14ebfe0d38675336c405ca1d.png ├── 447c2e5168e15cb21cafda55903db017.png ├── 4518ae089727239af6a569824b9b86e2.png ├── 47a50a61203b792b08a69b17c347b73f.png ├── 47c16228f3793455eb3436c78d21477d.png ├── 4a4a450cda66c931dce2ee4b3b3af329.png ├── 4b3a89ff7af9ad06700897f831201197.png ├── 4bcc0c5a2bb6223fa81b5bc6f0001367.png ├── 5028ac33d1b22df1c9509179c615ce6a.png ├── 520b3480cda5c9ab4ab7691ae9cdd696.png ├── 53bd5a42fe34b643a67c4232e71e3f99.png ├── 54f43bb3bb190844c7989f5864df1b2a.png ├── 57270a0aaa24e849c7139b71fc5a2879.png ├── 5cec990b9d6c1fdc3b340a364729aea6.png ├── 619a49e5557ce15be15ecd45dc767c72.png ├── 61a7b2eee29145e18a5583d931f62975.png ├── 64932f8d89d7f1750d3d40723007bd27.png ├── 65027d595737121ba207f647f86dfe09.png ├── 65e69cb6ea91c1602e057eca6ef99337.png ├── 688bcacb300f8efe5d6d8f6411d13d96.png ├── 6d547901f0a5fb3819d16aca0048b3ed.png ├── 6ecb4a72d18052ff65e393b54c3850a2.png ├── 7416c556a1ecfe80d64f32dbc9c18ae6.png ├── 74ad42ba372e0541d6f14058e2c33c0f.png ├── 750px-Euler_Method_Newton_Cooling.png ├── 79293ba1053dbc3f23c579b2e8141034.png ├── 7f019c11129cbf4b99ccb7f7e110acb2.png ├── 7f1c92a1977747914e9c5127764a9be4.png ├── 7f867e9ec901e62d2c8efa1ec9b4c5d6.png ├── 864ab514eca1fb4403576eb20ee0cb22.png ├── 8b92ddffc196683c9c4b2fb5f6f91d7c.png ├── 8c7f6df9ddc2c13f56a13ca113710587.png ├── 8c943c1cc7df75afeddd50d9ad93e28e.png ├── 91035139969200d1af754ee0d07acd6a.png ├── 9321b2aa2a198225b0dbe56040b49940.png ├── 953f4c8f564b5ed18e1b31d2716b5f8c.png ├── 981cbbc69bfa735ea07313f59feba714.png ├── 9df79dd98e1387bb25dc94ef7c0edcb3.png ├── 9eb10505118ec312428f2a4fb8b05d1f.png ├── Fifo.gif ├── Fulladder.png ├── HEnd.png ├── Halfadder.png ├── Hidato_Start.png ├── Hofstadter_conway_10K.gif ├── Hofstadter_conway_10K.png ├── NoiseOutput.png ├── OpenGlRunBasic.png ├── P92_1.png ├── P92_2.png ├── P92_3.png ├── P92_4.png ├── a026db06e1a9bd6945c85c8e17231725.png ├── a049527fb76c4d324e8790190e84ba28.png ├── a344abb2a9a00cb2de6679a485115ce3.png ├── a404f9cdcc88e086294f604a41599f92.png ├── a5e8e37e86ed379e1679034e0235bcd6.png ├── a96e7fe6a7eb7371ab85f6a135b84056.png ├── a9aea137ca2037a12d1cf6b4db76aa23.png ├── ac0831ae3a81b290afe4473899785ca7.png ├── af18dab590e0f994693fc34b6803c1e1.png ├── af307c5e65e7403b785f8a2c6b9d051a.png ├── af460b7986d4afc5fe920b86f15f522a.png ├── b14d36d888dae449d5c4fcfb6f4ff8ce.png ├── b7521c74cd98e492ade8dd3e9f40669a.png ├── bc37f835564eb6edd3510913644f4582.png ├── bdd8a535c6a8470767849ade18412c6d.png ├── c0f960b20df765fdc843e8c076225d5e.png ├── c53daded435e185afefbac417fef75e7.png ├── c7be4230ba817ec495c68f3c5fa10cfb.png ├── c7d9360aa57a7763c0e4764be5571c7b.png ├── c9f11575eec8aadcac4687458ded5aa3.png ├── cac27278c238ea97dbd86baa6afd19fe.png ├── cd81bcd600dda401fc4cfbc6646bbbc9.png ├── cf22c76e0c33c4fb96262638a28bd52b.png ├── copyright-cut.png ├── copyright-cut.xcf ├── copyright.png ├── copyright.xcf ├── d678d4d0af6d46165b3712e36b9718d9.png ├── d8c852f6bb73b0d042422df261390347.png ├── d9fa28df063d00917f713bd9de134ad5.png ├── da869c8260ae3107ca34619fd2642642.png ├── df44347863ac17dc898a13f44f681d01.png ├── e3a80911ae043c10931e49a6860405d6.png ├── e4e4d6b17e1e15dbddc307340f0a620f.png ├── e5d832c5ee9a16553e635e05c2892174.png ├── ea2b3ddffa2a578dbe5d923abd914aa5.png ├── ea8fba6081e51a2e4f0cd0d58c3c7032.png ├── eae4d1b7a3788fd85e5c4995efc7e196.png ├── eb1b9606546b68de1ad6063ac988df6c.png ├── f1267a46eea12e7c046cfc7fcb859cc2.png ├── f6e22469b4396d8fa34e202e5c716abc.png ├── f7e030787df8cd5d0ed6dd1802306d11.png ├── fca99b79cfa1b2d3a65395932e824f05.png ├── fe1a9857fd0a471baec6c538220e1bc9.png ├── fe9a069fecbc644b6137c76e3dbe21b8.png ├── ff5080d5609a0b345d34544d1336e741.png ├── kanji.png ├── kanji.xcf ├── title-text-frame.png ├── title-text-frame.xcf ├── title-text.png └── title-text.xcf ├── instructions ├── chapter.tex ├── example.pdf ├── figure-eps-converted-to.pdf ├── figure.eps ├── ftpinfo.txt ├── history.txt ├── instruct.pdf ├── liesmich.txt ├── quickstart.pdf ├── readme.txt ├── referenc.tex └── refguide.pdf ├── mainmatter ├── 99-lisp-problems.tex ├── all-functref.tex ├── all-rosettacode2.tex ├── function-ref-A.tex ├── function-ref-B.tex ├── function-ref-C.tex ├── function-ref-D.tex ├── function-ref-E.tex ├── function-ref-F.tex ├── function-ref-G.tex ├── function-ref-H.tex ├── function-ref-I.tex ├── function-ref-J.tex ├── function-ref-K.tex ├── function-ref-L.tex ├── function-ref-M.tex ├── function-ref-N.tex ├── function-ref-O.tex ├── function-ref-P.tex ├── function-ref-Q.tex ├── function-ref-R.tex ├── function-ref-S.tex ├── function-ref-T.tex ├── function-ref-U.tex ├── function-ref-V.tex ├── function-ref-W.tex ├── function-ref-X.tex ├── function-ref-Y.tex ├── function-ref-Z.tex ├── gnu-licence.tex ├── links-to-rosetta-tasks.tex ├── parts │ ├── appendix.tex │ ├── part-99-lisp-problems.tex │ ├── part-function-ref.tex │ ├── part-rosettacode.tex │ └── part.tex ├── rosettacode-A.tex ├── rosettacode-B.tex ├── rosettacode-C.tex ├── rosettacode-D.tex ├── rosettacode-E.tex ├── rosettacode-F.tex ├── rosettacode-G.tex ├── rosettacode-H.tex ├── rosettacode-I.tex ├── rosettacode-J.tex ├── rosettacode-K.tex ├── rosettacode-L.tex ├── rosettacode-M.tex ├── rosettacode-N.tex ├── rosettacode-O.tex ├── rosettacode-P.tex ├── rosettacode-Q.tex ├── rosettacode-R.tex ├── rosettacode-S.tex ├── rosettacode-T.tex ├── rosettacode-U.tex ├── rosettacode-V.tex ├── rosettacode-W.tex ├── rosettacode-X.tex ├── rosettacode-Y.tex ├── rosettacode-Z.tex └── rosettacode-numbers.tex ├── spbasic.bst ├── spmpsci.bst ├── spphys.bst ├── svmono.cls └── svmono.zip /.gitignore: -------------------------------------------------------------------------------- 1 | *.aux 2 | *.bbl 3 | *.blg 4 | *.dvi 5 | *.fdb_latexmk 6 | *.glg 7 | *.glo 8 | *.gls 9 | *.idx 10 | *.ilg 11 | *.ind 12 | *.ist 13 | *.lof 14 | *.log 15 | *.lot 16 | *.nav 17 | *.nlo 18 | *.out 19 | *.pdfsync 20 | *.ps 21 | *.snm 22 | *.synctex.gz 23 | *.toc 24 | *.vrb 25 | *.maf 26 | *.mtc 27 | *.mtc0 28 | -------------------------------------------------------------------------------- /HISTORY.org: -------------------------------------------------------------------------------- 1 | * TODO Version 1.03 2 | [2012-09-05 Mi 00:24] 3 | 4 | ** TODO announce new version in mailing-list 5 | [2012-09-05 Mi 00:24] 6 | ** TODO change version number and date in svmono.cls 7 | [2012-09-05 Mi 00:24] 8 | ** TODO replace download on github 9 | [2012-09-05 Mi 00:24] 10 | ** TODO replace pdf on scribd 11 | [2012-09-05 Mi 00:24] 12 | 13 | 14 | * NEXT Version 1.02 15 | [2012-08-26 So 01:11] 16 | 17 | 18 | ** TODO fix task 'reverse a string' p. 818 19 | [2012-08-30 Do 23:40] 20 | 21 | ** TODO delete redundant ’\\’ in rosetta tasks 22 | [2012-08-26 So 11:22] 23 | 24 | ** TODO fix link to "Hofstadter-Conway \$10,000 Sequence" in appendix 25 | [2012-09-05 Mi 13:45] 26 | ** TODO deal with utf-8 chars not printed by pdfLatex (try xetex or luatex?) 27 | [2012-09-02 So 23:28] 28 | Use 'natural sorting' (aka 'natural desaster') task to figure out solution) 29 | 30 | ** TODO add foreword (if possible) from Micheal Mol 31 | [2012-08-30 Do 19:11] 32 | 33 | ** TODO announce new version in mailing-list 34 | [2012-08-26 So 03:07] 35 | 36 | ** TODO change version number and date in svmono.cls 37 | [2012-08-26 So 01:11] 38 | ** TODO replace download on github 39 | [2012-08-26 So 01:11] 40 | ** TODO replace pdf on scribd 41 | [2012-08-26 So 01:11] 42 | 43 | 44 | * DONE Version 1.01 45 | CLOSED: [2012-09-05 Mi 20:30] 46 | :LOGBOOK: 47 | - State "DONE" from "NEXT" [2012-09-05 Mi 20:30] 48 | :END: 49 | [2012-08-26 So 00:11] 50 | 51 | 52 | ** DONE improve acknowledgement section, give more credit to task authors 53 | CLOSED: [2012-09-05 Mi 19:43] 54 | :LOGBOOK: 55 | - State "DONE" from "TODO" [2012-09-05 Mi 19:43] 56 | :END: 57 | [2012-09-05 Mi 13:48] 58 | ** DONE rename parts and chapters in appendix 59 | CLOSED: [2012-09-05 Mi 13:48] 60 | :LOGBOOK: 61 | - State "DONE" from "TODO" [2012-09-05 Mi 13:48] 62 | :END: 63 | [2012-09-05 Mi 13:47] 64 | ** DONE add table with links to all rosetta code tasks to appendix 65 | CLOSED: [2012-09-05 Mi 13:47] 66 | :LOGBOOK: 67 | - State "DONE" from "TODO" [2012-09-05 Mi 13:47] 68 | :END: 69 | [2012-09-05 Mi 13:47] 70 | ** DONE find out about and credit task authors (somehow ... *sigh*) 71 | CLOSED: [2012-09-05 Mi 13:47] 72 | :LOGBOOK: 73 | - State "DONE" from "TODO" [2012-09-05 Mi 13:47] 74 | :END: 75 | [2012-09-02 So 23:21] 76 | ** DONE fix missing image picolisp solution p.740 77 | CLOSED: [2012-09-05 Mi 00:33] 78 | :LOGBOOK: 79 | - State "DONE" from "TODO" [2012-09-05 Mi 00:33] 80 | :END: 81 | [2012-08-30 Do 19:23] 82 | ** DONE fix sample image in task pinstripe/Display p.735 83 | CLOSED: [2012-09-05 Mi 00:23] 84 | :LOGBOOK: 85 | - State "DONE" from "TODO" [2012-09-05 Mi 00:23] 86 | :END: 87 | [2012-08-30 Do 19:10] 88 | ** DONE replace .gif in task 'Hofstadter-Conway \$10,000 sequence' with .png 89 | CLOSED: [2012-08-26 So 11:32] 90 | :LOGBOOK: 91 | - State "DONE" from "TODO" [2012-08-26 So 11:32] 92 | :END: 93 | [2012-08-26 So 11:23] 94 | ** DONE rosettacode-A figures: replace [htbp] with [H] 95 | CLOSED: [2012-08-26 So 11:20] 96 | :LOGBOOK: 97 | - State "DONE" from "TODO" [2012-08-26 So 11:20] 98 | :END: 99 | [2012-08-26 So 11:17] 100 | ** DONE fix rosetta task 'Arithmetic-geometric mean 101 | CLOSED: [2012-08-26 So 11:20] 102 | :LOGBOOK: 103 | - State "DONE" from "TODO" [2012-08-26 So 11:20] 104 | :END: 105 | [2012-08-26 So 11:19] 106 | ** DONE fix rosetta task 'Arena storage pool' 107 | CLOSED: [2012-08-26 So 11:20] 108 | :LOGBOOK: 109 | - State "DONE" from "TODO" [2012-08-26 So 11:20] 110 | :END: 111 | [2012-08-26 So 11:13] 112 | ** DONE add part before appendix 113 | CLOSED: [2012-09-02 So 23:20] 114 | :LOGBOOK: 115 | - State "DONE" from "TODO" [2012-09-02 So 23:20] 116 | :END: 117 | [2012-08-26 So 03:16] 118 | ** DONE fix overly wide code-blocks in function-reference 119 | CLOSED: [2012-09-02 So 23:15] 120 | :LOGBOOK: 121 | - State "DONE" from "NEXT" [2012-09-02 So 23:15] 122 | :END: 123 | [2012-08-26 So 03:06] 124 | *** DONE A 125 | CLOSED: [2012-09-02 So 21:30] 126 | :LOGBOOK: 127 | - State "DONE" from "TODO" [2012-09-02 So 21:30] 128 | :END: 129 | [2012-09-02 So 21:09] 130 | *** DONE B 131 | CLOSED: [2012-09-02 So 21:31] 132 | :LOGBOOK: 133 | - State "DONE" from "TODO" [2012-09-02 So 21:31] 134 | :END: 135 | [2012-09-02 So 21:09] 136 | *** DONE C 137 | CLOSED: [2012-09-02 So 21:33] 138 | :LOGBOOK: 139 | - State "DONE" from "TODO" [2012-09-02 So 21:33] 140 | :END: 141 | [2012-09-02 So 21:09] 142 | *** DONE D 143 | CLOSED: [2012-09-02 So 21:45] 144 | :LOGBOOK: 145 | - State "DONE" from "TODO" [2012-09-02 So 21:45] 146 | :END: 147 | [2012-09-02 So 21:09] 148 | *** DONE E 149 | CLOSED: [2012-09-02 So 21:54] 150 | :LOGBOOK: 151 | - State "DONE" from "TODO" [2012-09-02 So 21:54] 152 | :END: 153 | [2012-09-02 So 21:09] 154 | *** DONE F 155 | CLOSED: [2012-09-02 So 22:06] 156 | :LOGBOOK: 157 | - State "DONE" from "TODO" [2012-09-02 So 22:06] 158 | :END: 159 | [2012-09-02 So 21:09] 160 | *** DONE G 161 | CLOSED: [2012-09-02 So 22:06] 162 | :LOGBOOK: 163 | - State "DONE" from "TODO" [2012-09-02 So 22:06] 164 | :END: 165 | [2012-09-02 So 21:09] 166 | *** DONE H 167 | CLOSED: [2012-09-02 So 22:07] 168 | :LOGBOOK: 169 | - State "DONE" from "TODO" [2012-09-02 So 22:07] 170 | :END: 171 | [2012-09-02 So 21:09] 172 | *** DONE I 173 | CLOSED: [2012-09-02 So 22:09] 174 | :LOGBOOK: 175 | - State "DONE" from "TODO" [2012-09-02 So 22:09] 176 | :END: 177 | [2012-09-02 So 21:09] 178 | *** DONE J 179 | CLOSED: [2012-09-02 So 22:09] 180 | :LOGBOOK: 181 | - State "DONE" from "TODO" [2012-09-02 So 22:09] 182 | :END: 183 | [2012-09-02 So 21:09] 184 | *** DONE K 185 | CLOSED: [2012-09-02 So 22:15] 186 | :LOGBOOK: 187 | - State "DONE" from "TODO" [2012-09-02 So 22:15] 188 | :END: 189 | [2012-09-02 So 21:09] 190 | *** DONE L 191 | CLOSED: [2012-09-02 So 22:24] 192 | :LOGBOOK: 193 | - State "DONE" from "TODO" [2012-09-02 So 22:24] 194 | :END: 195 | [2012-09-02 So 21:09] 196 | *** DONE M 197 | CLOSED: [2012-09-02 So 22:27] 198 | :LOGBOOK: 199 | - State "DONE" from "TODO" [2012-09-02 So 22:27] 200 | :END: 201 | [2012-09-02 So 21:09] 202 | *** DONE N 203 | CLOSED: [2012-09-02 So 22:29] 204 | :LOGBOOK: 205 | - State "DONE" from "TODO" [2012-09-02 So 22:29] 206 | :END: 207 | [2012-09-02 So 21:09] 208 | *** DONE O 209 | CLOSED: [2012-09-02 So 22:30] 210 | :LOGBOOK: 211 | - State "DONE" from "TODO" [2012-09-02 So 22:30] 212 | :END: 213 | [2012-09-02 So 21:09] 214 | *** DONE P 215 | CLOSED: [2012-09-02 So 22:48] 216 | :LOGBOOK: 217 | - State "DONE" from "TODO" [2012-09-02 So 22:48] 218 | :END: 219 | [2012-09-02 So 21:09] 220 | *** DONE Q 221 | CLOSED: [2012-09-02 So 22:52] 222 | :LOGBOOK: 223 | - State "DONE" from "TODO" [2012-09-02 So 22:52] 224 | :END: 225 | [2012-09-02 So 21:09] 226 | *** DONE R 227 | CLOSED: [2012-09-02 So 22:59] 228 | :LOGBOOK: 229 | - State "DONE" from "TODO" [2012-09-02 So 22:59] 230 | :END: 231 | [2012-09-02 So 21:09] 232 | *** DONE S 233 | CLOSED: [2012-09-02 So 23:06] 234 | :LOGBOOK: 235 | - State "DONE" from "TODO" [2012-09-02 So 23:06] 236 | :END: 237 | [2012-09-02 So 21:09] 238 | *** DONE T 239 | CLOSED: [2012-09-02 So 23:08] 240 | :LOGBOOK: 241 | - State "DONE" from "TODO" [2012-09-02 So 23:08] 242 | :END: 243 | [2012-09-02 So 21:08] 244 | *** DONE U 245 | CLOSED: [2012-09-02 So 23:09] 246 | :LOGBOOK: 247 | - State "DONE" from "TODO" [2012-09-02 So 23:09] 248 | :END: 249 | [2012-09-02 So 21:08] 250 | *** DONE V 251 | CLOSED: [2012-09-02 So 23:12] 252 | :LOGBOOK: 253 | - State "DONE" from "TODO" [2012-09-02 So 23:12] 254 | :END: 255 | [2012-09-02 So 21:08] 256 | *** DONE W 257 | CLOSED: [2012-09-02 So 23:13] 258 | :LOGBOOK: 259 | - State "DONE" from "TODO" [2012-09-02 So 23:13] 260 | :END: 261 | [2012-09-02 So 21:08] 262 | *** DONE X 263 | CLOSED: [2012-09-02 So 23:14] 264 | :LOGBOOK: 265 | - State "DONE" from "TODO" [2012-09-02 So 23:14] 266 | :END: 267 | [2012-09-02 So 21:08] 268 | *** DONE Y 269 | CLOSED: [2012-09-02 So 23:14] 270 | :LOGBOOK: 271 | - State "DONE" from "TODO" [2012-09-02 So 23:14] 272 | :END: 273 | [2012-09-02 So 21:08] 274 | *** DONE Z 275 | CLOSED: [2012-09-02 So 23:14] 276 | :LOGBOOK: 277 | - State "DONE" from "TODO" [2012-09-02 So 23:14] 278 | :END: 279 | [2012-09-02 So 21:08] 280 | ** DONE fix function-ref-K chapter header 281 | CLOSED: [2012-09-02 So 22:10] 282 | :LOGBOOK: 283 | - State "DONE" from "TODO" [2012-09-02 So 22:10] 284 | :END: 285 | [2012-08-26 So 03:12] 286 | ** DONE fix function-ref-D p.1144 287 | CLOSED: [2012-08-26 So 03:03] 288 | :LOGBOOK: 289 | - State "DONE" from "TODO" [2012-08-26 So 03:03] 290 | :END: 291 | [2012-08-26 So 01:30] 292 | ** DONE announce new version in mailing-list 293 | CLOSED: [2012-09-05 Mi 20:30] 294 | :LOGBOOK: 295 | - State "DONE" from "TODO" [2012-09-05 Mi 20:30] 296 | :END: 297 | [2012-08-26 So 03:07] 298 | ** DONE change version number and date in svmono.cls 299 | CLOSED: [2012-09-05 Mi 20:15] 300 | :LOGBOOK: 301 | - State "DONE" from "TODO" [2012-09-05 Mi 20:15] 302 | :END: 303 | [2012-08-26 So 01:11] 304 | ** DONE replace download on github 305 | CLOSED: [2012-09-05 Mi 20:20] 306 | :LOGBOOK: 307 | - State "DONE" from "TODO" [2012-09-05 Mi 20:20] 308 | :END: 309 | [2012-08-26 So 01:11] 310 | ** DONE replace pdf on scribd 311 | CLOSED: [2012-09-05 Mi 20:30] 312 | :LOGBOOK: 313 | - State "DONE" from "TODO" [2012-09-05 Mi 20:30] 314 | :END: 315 | [2012-08-26 So 01:11] 316 | 317 | 318 | * DONE Version 1.0 319 | CLOSED: [2012-08-26 So 00:19] 320 | :LOGBOOK: 321 | - State "DONE" from "" [2012-08-26 So 00:19] 322 | :END: 323 | [2012-08-23 Do 23:45] 324 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | picolisp-by-example 2 | =================== 3 | 4 | The source code of the free book **PicoLisp by Example** 5 | 6 | *Why PicoLisp?* Short answer: PicoLisp as a language is 7 | maximizing expressive power while minimizing complexity 8 | 9 | **PicoLisp** is a very simple and succinct, yet expressive language - 10 | and it is free (MIT/X11 License). Furthermore, PicoLisp has two 11 | characteristic features which are not found to that extent in other 12 | languages: 13 | 14 | * An integrated database 15 | * Equivalence of code and data 16 | 17 | These two features alone, and how they are used in combination, make 18 | it worth to take a closer look at PicoLisp. 19 | 20 | The book *PicoLisp by Example* has three parts: 21 | 22 | 1. 99 Lisp Problems (with PicoLisp solutions for more than half of them) 23 | 2. Rosetta Code Tasks (more than 600 PicoLisp solutions) 24 | 3. PicoLisp Function Reference (with a complete descriptions of all symbols that constitute the language core) 25 | 26 | It is an accompaniment of another volume, **PicoLisp Works**, 27 | (https://github.com/tj64/picolisp-works) with (almost) all docs ever 28 | written about PicoLisp. Both volumes are freely available as *pdf* 29 | files, e.g. on [Scribd] (http://scribd.com). 30 | 31 | This book is published under the *GNU Free Documentation Licence*. 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /backmatter/glossary.tex: -------------------------------------------------------------------------------- 1 | %%%%%%%%%%%%%%%%%%%%%%acronym.tex%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2 | % sample list of acronyms 3 | % 4 | % Use this file as a template for your own input. 5 | % 6 | %%%%%%%%%%%%%%%%%%%%%%%% Springer %%%%%%%%%%%%%%%%%%%%%%%%%% 7 | 8 | \Extrachap{Glossary} 9 | 10 | 11 | Use the template \emph{glossary.tex} together with the Springer document class SVMono (monograph-type books) or SVMult (edited books) to style your glossary\index{glossary} in the Springer layout. 12 | 13 | 14 | \runinhead{glossary term} Write here the description of the glossary term. Write here the description of the glossary term. Write here the description of the glossary term. 15 | 16 | \runinhead{glossary term} Write here the description of the glossary term. Write here the description of the glossary term. Write here the description of the glossary term. 17 | 18 | \runinhead{glossary term} Write here the description of the glossary term. Write here the description of the glossary term. Write here the description of the glossary term. 19 | 20 | \runinhead{glossary term} Write here the description of the glossary term. Write here the description of the glossary term. Write here the description of the glossary term. 21 | 22 | \runinhead{glossary term} Write here the description of the glossary term. Write here the description of the glossary term. Write here the description of the glossary term. -------------------------------------------------------------------------------- /backmatter/solutions.tex: -------------------------------------------------------------------------------- 1 | 2 | \Extrachap{Solutions} 3 | 4 | \section*{Problems of Chapter~\ref{intro}} 5 | 6 | \begin{sol}{prob1} 7 | The solution\index{problems}\index{solutions} is revealed here. 8 | \end{sol} 9 | 10 | 11 | \begin{sol}{prob2} 12 | \textbf{Problem Heading}\\ 13 | (a) The solution of first part is revealed here.\\ 14 | (b) The solution of second part is revealed here. 15 | \end{sol} 16 | 17 | -------------------------------------------------------------------------------- /book.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/book.pdf -------------------------------------------------------------------------------- /book.tex: -------------------------------------------------------------------------------- 1 | %%%%%%%%%%%%%%%%%%%% book.tex %%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2 | % 3 | % sample root file for the chapters of your "monograph" 4 | % 5 | % Use this file as a template for your own input. 6 | % 7 | %%%%%%%%%%%%%%%% Springer-Verlag %%%%%%%%%%%%%%%%%%%%%%%%%% 8 | 9 | 10 | % RE %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 11 | \documentclass[graybox,envcountchap,sectrefs]{svmono} 12 | 13 | % choose options for [] as required from the list 14 | % in the Reference Guide 15 | 16 | 17 | 18 | \usepackage{mathptmx} 19 | \usepackage{helvet} 20 | \usepackage{courier} 21 | % 22 | \usepackage{type1cm} 23 | 24 | \usepackage{makeidx} % allows index generation 25 | \usepackage{graphicx} % standard LaTeX graphics tool 26 | % when including figure files 27 | \usepackage{multicol} % used for the two-column index 28 | \usepackage[bottom]{footmisc}% places footnotes at page bottom 29 | \usepackage{parskip} 30 | 31 | % \usepackage[utf8x]{inputenc} 32 | % \usepackage[T1]{fontenc} 33 | % \usepackage{lmodern} 34 | 35 | \usepackage{ctable} 36 | \usepackage{fixltx2e} 37 | \usepackage{here} 38 | \usepackage{caption} 39 | % \usepackage{ucs} 40 | % \usepackage[T1]{fontenc} 41 | % \usepackage{CJKutf8} 42 | % \usepackage[english]{babel} 43 | 44 | % \usepackage[margin=4cm]{geometry} 45 | \usepackage{fancybox} 46 | \usepackage{longtable} 47 | 48 | % define detailled toc 49 | \usepackage[explicit]{titlesec} 50 | \usepackage{titletoc} 51 | 52 | % longtable 53 | % \usepackage{longtable,lscape} 54 | % \usepackage{rotating} 55 | 56 | % \usepackage{multirow,multicol} 57 | \usepackage[breaklinks]{hyperref} 58 | 59 | 60 | \titleformat{name=\section,numberless} 61 | {\normalfont\Large\bfseries}{}{0em}{#1\addcontentsline{ptc}{section}{#1}} 62 | 63 | % see the list of further useful packages 64 | % in the Reference Guide 65 | 66 | \makeindex % used for the subject index 67 | % please use the style svind.ist with 68 | % your makeindex program 69 | 70 | 71 | % define a customized verbatim environment 72 | \newenvironment{wideverbatim}% 73 | {\vskip\baselineskip\VerbatimEnvironment 74 | \begin{Sbox}\begin{BVerbatim}} 75 | {\end{BVerbatim}% 76 | \end{Sbox}\noindent\centerline{\TheSbox}\vskip\baselineskip} 77 | 78 | % % define a new environment for japanese kanji characters 79 | % \newenvironment{Japanese}{% 80 | % \CJKfamily{min}% 81 | % \CJKtilde 82 | % \CJKnospace}{} 83 | 84 | 85 | % Define new description environment (better option 2) 86 | \makeatletter 87 | % Instead of \newenvironment 88 | \renewenvironment{description} 89 | {\list{}{\labelwidth\z@ \itemindent-\leftmargin 90 | \let\makelabel\descriptionlabel}} 91 | {\endlist} 92 | % Instead of \newcommand* 93 | \let\descriptionlabel\relax 94 | \newcommand*\descriptionlabel[1]{\hspace\labelsep 95 | \normalfont\bfseries #1} 96 | \makeatother 97 | 98 | 99 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 100 | 101 | \begin{document} 102 | 103 | \author{Alexander Burger, Thorsten Jolitz} 104 | \title{PicoLisp by Example} 105 | \subtitle{-- 600+ Rosetta Code Tasks with Solutions --} 106 | \maketitle 107 | 108 | % \parindent{0pt} 109 | 110 | \frontmatter%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 111 | 112 | \include{frontmatter/dedic} 113 | % \include{frontmatter/foreword} 114 | \include{frontmatter/preface} 115 | \include{frontmatter/acknow} 116 | 117 | \renewcommand\contentsname{General Contents} 118 | \tableofcontents 119 | \startcontents 120 | \printcontents{}{-1}{\chapter*{Detailed Contents}} 121 | 122 | 123 | % \tableofcontents 124 | 125 | % \include{frontmatter/acronym} 126 | 127 | 128 | \mainmatter%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 129 | \include{mainmatter/parts/part-99-lisp-problems} 130 | \include{mainmatter/99-lisp-problems} 131 | \include{mainmatter/parts/part-rosettacode} 132 | \include{mainmatter/rosettacode-numbers} 133 | \include{mainmatter/rosettacode-A} 134 | \include{mainmatter/rosettacode-B} 135 | \include{mainmatter/rosettacode-C} 136 | \include{mainmatter/rosettacode-D} 137 | \include{mainmatter/rosettacode-E} 138 | \include{mainmatter/rosettacode-F} 139 | \include{mainmatter/rosettacode-G} 140 | \include{mainmatter/rosettacode-H} 141 | \include{mainmatter/rosettacode-I} 142 | \include{mainmatter/rosettacode-J} 143 | \include{mainmatter/rosettacode-K} 144 | \include{mainmatter/rosettacode-L} 145 | \include{mainmatter/rosettacode-M} 146 | \include{mainmatter/rosettacode-N} 147 | \include{mainmatter/rosettacode-O} 148 | \include{mainmatter/rosettacode-P} 149 | \include{mainmatter/rosettacode-Q} 150 | \include{mainmatter/rosettacode-R} 151 | \include{mainmatter/rosettacode-S} 152 | \include{mainmatter/rosettacode-T} 153 | \include{mainmatter/rosettacode-U} 154 | \include{mainmatter/rosettacode-V} 155 | \include{mainmatter/rosettacode-W} 156 | \include{mainmatter/rosettacode-X} 157 | \include{mainmatter/rosettacode-Y} 158 | \include{mainmatter/rosettacode-Z} 159 | \include{mainmatter/parts/part-function-ref} 160 | \include{mainmatter/function-ref-A} 161 | \include{mainmatter/function-ref-B} 162 | \include{mainmatter/function-ref-C} 163 | \include{mainmatter/function-ref-D} 164 | \include{mainmatter/function-ref-E} 165 | \include{mainmatter/function-ref-F} 166 | \include{mainmatter/function-ref-G} 167 | \include{mainmatter/function-ref-H} 168 | \include{mainmatter/function-ref-I} 169 | \include{mainmatter/function-ref-J} 170 | \include{mainmatter/function-ref-K} 171 | \include{mainmatter/function-ref-L} 172 | \include{mainmatter/function-ref-M} 173 | \include{mainmatter/function-ref-N} 174 | \include{mainmatter/function-ref-O} 175 | \include{mainmatter/function-ref-P} 176 | \include{mainmatter/function-ref-Q} 177 | \include{mainmatter/function-ref-R} 178 | \include{mainmatter/function-ref-S} 179 | \include{mainmatter/function-ref-T} 180 | \include{mainmatter/function-ref-U} 181 | \include{mainmatter/function-ref-V} 182 | \include{mainmatter/function-ref-W} 183 | \include{mainmatter/function-ref-X} 184 | \include{mainmatter/function-ref-Y} 185 | \include{mainmatter/function-ref-Z} 186 | \include{mainmatter/parts/appendix} 187 | \include{mainmatter/gnu-licence} 188 | \include{mainmatter/links-to-rosetta-tasks} 189 | 190 | \backmatter%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 191 | % \include{backmatter/glossary} 192 | % \include{backmatter/solutions} 193 | \printindex 194 | 195 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 196 | 197 | \end{document} 198 | 199 | 200 | 201 | 202 | 203 | -------------------------------------------------------------------------------- /frontmatter/acknow.tex: -------------------------------------------------------------------------------- 1 | %%%%%%%%%%%%%%%%%%%%%%acknow.tex%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2 | % sample acknowledgement chapter 3 | % 4 | % Use this file as a template for your own input. 5 | % 6 | %%%%%%%%%%%%%%%%%%%%%%%% Springer %%%%%%%%%%%%%%%%%%%%%%%%%% 7 | 8 | \extrachap{Acknowledgements} 9 | 10 | This book was produced using the following software tools: 11 | 12 | \begin{itemize} 13 | \item Archlinux 14 | \item GNU Emacs (AucTex) 15 | \item LaTeX 16 | \item Git 17 | \item Pandoc 18 | \item Gimp 19 | \item PicoLisp 20 | \end{itemize} 21 | 22 | The book-layout is based on the freely available \emph{Springer} 23 | \texttt{LaTeX} template for monographs 24 | (\href{http://www.springer.com/authors/book+authors?SGWID=0-154102-12-970131-0}{\texttt{svmono}}). 25 | 26 | The first part of the book (\textbf{99 Lisp Problems}) is based on a Prolog 27 | problem list by \texttt{werner.hett@hti.bfh.ch}. The original is at 28 | 29 | \href{https://prof.ti.bfh.ch/hew1/informatik3/prolog/p-99}{\texttt{https://prof.ti.bfh.ch/hew1/informatik3/prolog/p-99}}. 30 | 31 | The core part of the book (\textbf{Rosetta Code Tasks}) is based on 32 | the programming tasks published on 33 | \href{http://rosettacode.org/wiki/Rosetta_Code}{\texttt{http://rosettacode.org/wiki/Rosetta\_Code}}. 34 | These sometimes quite elaborated task descriptions have been 35 | contributed by members of the \emph{Rosetta Code} community. A task 36 | description might be the work of one or several community members. 37 | Often one person\footnote{as an outstanding example for the great work 38 | of the \emph{Rosetta Code} community, \emph{Mr. Donald McCarthy} (aka 39 | \href{http://rosettacode.org/wiki/User:Paddy3118}{Paddy3118}) alone 40 | has contributed 117 initial task descriptions (\emph{accessed online: 41 | 05 Sept. 2012})} delivers the initial task, that is then discussed and 42 | refined by the community. 43 | 44 | At the time of this writing, it is technically challenging to 45 | correctly credit the task authors for their work. Therefore we 46 | added \emph{links} to the original webpages for all of the more 47 | than 600 Rosetta Code tasks included in this book (see 48 | \emph{Appendix}). When visiting a task page on 49 | \href{http://rosettacode.org/wiki/Rosetta_Code}{\texttt{http://rosettacode.org/wiki/Rosetta\_Code}}, 50 | the reader can chose the \emph{View History} tab and scroll through 51 | the sometimes long list of contributions to the page. Most likely, the 52 | oldest entry in the history list shows the original contributor of the 53 | task description, but other contributions to the task description 54 | might be buried in the many pages of 'diffs' (that include all 55 | changes to the hundreds of task solutions too). 56 | 57 | The \emph{Rosetta Code} community is currently engaged in improving 58 | the visibility of the task description authors on the site: 59 | 60 | \href{http://rosettacode.org/wiki/Task\_Description\_Authors}{\texttt{http://rosettacode.org/wiki/Task\_Description\_Authors}} 61 | 62 | Future versions of this book will include or link-to the results of 63 | this community process in order to better credit the members of the 64 | \emph{Rosetta Code} community for their impressive voluntary 65 | contributions. 66 | 67 | While the \emph{Rosetta Code} task descriptions are the work of many 68 | people, all the \textbf{PicoLisp solutions} presented in this book are 69 | written by one single person: \emph{Alexander Burger}, the creator of 70 | PicoLisp. 71 | 72 | The source code for this book can be found on Github (\href{https://github.com/tj64/picolisp-by-example}{\url{https://github.com/tj64/picolisp-by-example}} 73 | 74 | % \vfill 75 | 76 | % \begin{wideverbatim} 77 | % Copyright (c) 2012 Alexander Burger, Thorsten Jolitz 78 | % Permission is granted to copy, distribute and/or modify this document 79 | % under the terms of the GNU Free Documentation License, Version 1.2 80 | % or any later version published by the Free Software Foundation; 81 | % with no Invariant Sections, no Front-Cover Texts, and no Back-Cover 82 | % Texts. A copy of the license is included in the chapter entitled "GNU 83 | % Free Documentation License". 84 | % \end{wideverbatim} 85 | 86 | 87 | 88 | -------------------------------------------------------------------------------- /frontmatter/acronym.tex: -------------------------------------------------------------------------------- 1 | %%%%%%%%%%%%%%%%%%%%%%acronym.tex%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2 | % sample list of acronyms 3 | % 4 | % Use this file as a template for your own input. 5 | % 6 | %%%%%%%%%%%%%%%%%%%%%%%% Springer %%%%%%%%%%%%%%%%%%%%%%%%%% 7 | 8 | \extrachap{Acronyms} 9 | 10 | Use the template \emph{acronym.tex} together with the Springer document class SVMono (monograph-type books) or SVMult (edited books) to style your list(s) of abbreviations or symbols in the Springer layout. 11 | 12 | Lists of abbreviations\index{acronyms, list of}, symbols\index{symbols, list of} and the like are easily formatted with the help of the Springer-enhanced \verb|description| environment. 13 | 14 | \begin{description}[CABR] 15 | \item[ABC]{Spelled-out abbreviation and definition} 16 | \item[BABI]{Spelled-out abbreviation and definition} 17 | \item[CABR]{Spelled-out abbreviation and definition} 18 | \end{description} -------------------------------------------------------------------------------- /frontmatter/dedic.tex: -------------------------------------------------------------------------------- 1 | 2 | %%%%%%%%%%%%%%%%%%%%%%% dedic.tex %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 3 | % 4 | % sample dedication 5 | % 6 | % Use this file as a template for your own input. 7 | % 8 | %%%%%%%%%%%%%%%%%%%%%%%% Springer %%%%%%%%%%%%%%%%%%%%%%%%%% 9 | 10 | \begin{dedication} 11 | \begin{verse} 12 | \begin{flushright} 13 | \textit{"Technology's development proceeds\\ 14 | from primitive\\ 15 | via complicated\\ 16 | to simple solutions."}\\ 17 | 18 | (Antoine de Saint-Exup\'{e}ry) 19 | \end{flushright} 20 | \end{verse} 21 | \end{dedication} 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /frontmatter/foreword.tex: -------------------------------------------------------------------------------- 1 | %%%%%%%%%%%%%%%%%%%%%%foreword.tex%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2 | % sample foreword 3 | % 4 | % Use this file as a template for your own input. 5 | % 6 | %%%%%%%%%%%%%%%%%%%%%%%% Springer %%%%%%%%%%%%%%%%%%%%%%%%%% 7 | 8 | \foreword 9 | 10 | %% Please have the foreword written here 11 | 12 | 13 | \vspace{\baselineskip} 14 | \begin{flushright}\noindent 15 | Berlin, September 2012 \hfill {\it Thorsten Jolitz}\\ 16 | \end{flushright} 17 | 18 | 19 | -------------------------------------------------------------------------------- /frontmatter/preface.tex: -------------------------------------------------------------------------------- 1 | %%%%%%%%%%%%%%%%%%%%%%preface.tex%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2 | % sample preface 3 | % 4 | % Use this file as a template for your own input. 5 | % 6 | %%%%%%%%%%%%%%%%%%%%%%%% Springer %%%%%%%%%%%%%%%%%%%%%%%%%% 7 | 8 | \preface 9 | 10 | %% Please write your preface here 11 | % Use the template \emph{preface.tex} together with the Springer document class SVMono (monograph-type books) or SVMult (edited books) to style your preface in the Springer layout. 12 | 13 | % A preface\index{preface} is a book's preliminary statement, usually written by the \textit{author or editor} of a work, which states its origin, scope, purpose, plan, and intended audience, and which sometimes includes afterthoughts and acknowledgments of assistance. 14 | 15 | % When written by a person other than the author, it is called a foreword. The preface or foreword is distinct from the introduction, which deals with the subject of the work. 16 | 17 | % Customarily \textit{acknowledgments} are included as last part of the preface. 18 | 19 | 20 | \emph{Why PicoLisp?} Short answer: PicoLisp as a language is 21 | maximizing expressive power while minimizing complexity 22 | 23 | PicoLisp is a very simple and succinct, yet expressive language -- and 24 | it is free (MIT/X11 License). Furthermore, PicoLisp has two 25 | characteristic features which are not found to that extent in other 26 | languages: 27 | 28 | \begin{enumerate} 29 | \item 30 | An integrated database 31 | \item 32 | Equivalence of code and data 33 | \end{enumerate} 34 | 35 | These two features alone, and how they are used in combination, make 36 | it worth to take a closer look at PicoLisp. 37 | 38 | \begin{description} 39 | \item[\emph{Integrated Database}] 40 | \href{http://software-lab.de/doc/ref.html\#dbase}{Database} 41 | functionality is built into the core of the language. PicoLisp 42 | \textbf{is} a database query and manipulation language. 43 | 44 | Database entities are first class objects. They are called ``external 45 | symbols'', because they are automatically fetched from database files 46 | when accessed, but otherwise behave like normal symbols. 47 | 48 | This fetching from external files is completely transparent, the 49 | symbols ``are just there'', and there is no need (or even a function) 50 | to read or write them explicitly. 51 | \href{http://software-lab.de/doc/ref.html\#pilog}{Pilog} (a built-in 52 | Prolog engine) is used as a query language. 53 | 54 | It is possible with PicoLisp to build large multi-user databases, 55 | distributed across many machines or in a cloud. Such a database system 56 | can be optimally fine-tuned, because all its levels are under the 57 | developer's control. 58 | 59 | \item[\emph{Equivalence of Code and Data}] 60 | 61 | This is actually a feature of Lisp in general. However, PicoLisp 62 | really \emph{lives} it. It makes it easy to write things like the 63 | HTML, PostScript or TeX libraries, exploring a syntax of nested 64 | function calls. This results in very succinct and precisely 65 | expressed programs. 66 | 67 | For a closer explanation, see the article 68 | \href{!wiki?EquivalenceCodeData}{The Equivalence of Code and Data}. 69 | 70 | \item[\emph{Expressiveness}] PicoLisp is a very expressive language. Programs 71 | are often much shorter and concise than equivalent programs written in 72 | other languages. 73 | 74 | Examples of various programming tasks and their solutions, originally 75 | published at 76 | \href{http://rosettacode.org/wiki/Category:PicoLisp}{rosettacode.org}, 77 | can be found in this book. 78 | 79 | \item[\emph{Efficiency}] 80 | 81 | PicoLisp uses (at least when compared to other 82 | Lisps) very little memory, on disk as well as in memory (heap space). 83 | 84 | For example, the installation size in the OpenWRT distribution is only 85 | 575 kB (uncompressed), where the statically linked interpreter with 86 | 296 kB takes the largest part. Yet, it includes the full runtime 87 | system with interpreter, database, HTTP server, XHTML and JavaScript 88 | application framework, watchdog, and the debugger, PostScript and XML 89 | libraries. 90 | 91 | PicoLisp has no compiler, everything starts up very quickly, and code 92 | dynamically loaded at runtime (e.g. GUI pages) is immediately ready. 93 | Yet, the interpreter is quite fast, usually three times a fast as 94 | Python, for example. See also the article 95 | \href{!wiki?NeedForSpeed}{Need For Speed}. 96 | \end{description} 97 | 98 | 99 | \vspace{1cm} 100 | \begin{flushright}\noindent 101 | Langweid, August 2012\hfill {\it Alexander Burger}\\ 102 | Berlin, August 2012\hfill {\it Thorsten Jolitz}\\\end{flushright} 103 | 104 | 105 | % \vspace{\baselineskip} 106 | % \begin{flushright}\noindent 107 | % Langweid, September 2012 \hfill {\it Alexander Burger} 108 | % \end{flushright} 109 | 110 | 111 | -------------------------------------------------------------------------------- /graphics/02617b75af4d512caf92071211ac3d6a.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/02617b75af4d512caf92071211ac3d6a.png -------------------------------------------------------------------------------- /graphics/058aad0ea1d9f900745a1e688b75cec8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/058aad0ea1d9f900745a1e688b75cec8.png -------------------------------------------------------------------------------- /graphics/05e249cad1085102aca0ad06c5eb4236.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/05e249cad1085102aca0ad06c5eb4236.png -------------------------------------------------------------------------------- /graphics/06242fdab96c6fc34555b2d3ac36ff56.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/06242fdab96c6fc34555b2d3ac36ff56.png -------------------------------------------------------------------------------- /graphics/0725da7bdcacd1fcb101173ffeebacae.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/0725da7bdcacd1fcb101173ffeebacae.png -------------------------------------------------------------------------------- /graphics/07915cb82d7470aff79636e93397abe3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/07915cb82d7470aff79636e93397abe3.png -------------------------------------------------------------------------------- /graphics/0a1294f5ac71c931e686c647d900fbcb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/0a1294f5ac71c931e686c647d900fbcb.png -------------------------------------------------------------------------------- /graphics/0ae4053de098cc9554752b190a38bc56.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/0ae4053de098cc9554752b190a38bc56.png -------------------------------------------------------------------------------- /graphics/12595bb2b15b5d8b7263aba68c137db3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/12595bb2b15b5d8b7263aba68c137db3.png -------------------------------------------------------------------------------- /graphics/128px-Negslope.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/128px-Negslope.png -------------------------------------------------------------------------------- /graphics/128px-Posslope.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/128px-Posslope.png -------------------------------------------------------------------------------- /graphics/128px-Unfilledcirc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/128px-Unfilledcirc.png -------------------------------------------------------------------------------- /graphics/14460313caad694cfeab489628009eab.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/14460313caad694cfeab489628009eab.png -------------------------------------------------------------------------------- /graphics/1465b5194836899e7331a9fcf9cda03e.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/1465b5194836899e7331a9fcf9cda03e.png -------------------------------------------------------------------------------- /graphics/150px-Triangle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/150px-Triangle.png -------------------------------------------------------------------------------- /graphics/180df89d659ad6dc8f29a74fffe1cfb5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/180df89d659ad6dc8f29a74fffe1cfb5.png -------------------------------------------------------------------------------- /graphics/180px-4bitsadder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/180px-4bitsadder.png -------------------------------------------------------------------------------- /graphics/180px-Galtonbox-Unicon.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/180px-Galtonbox-Unicon.PNG -------------------------------------------------------------------------------- /graphics/180px-Pinstripe-mono-unicon.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/180px-Pinstripe-mono-unicon.gif -------------------------------------------------------------------------------- /graphics/180px-Pinstripe-mono-unicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/180px-Pinstripe-mono-unicon.png -------------------------------------------------------------------------------- /graphics/180px-Van_der_corput_distribution.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/180px-Van_der_corput_distribution.png -------------------------------------------------------------------------------- /graphics/180px-Xor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/180px-Xor.png -------------------------------------------------------------------------------- /graphics/1a4bfb06a8eb34d1ac09405c02d064c4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/1a4bfb06a8eb34d1ac09405c02d064c4.png -------------------------------------------------------------------------------- /graphics/1a6a1cf8fdc67e4bd31e60a052c3c9ae.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/1a6a1cf8fdc67e4bd31e60a052c3c9ae.png -------------------------------------------------------------------------------- /graphics/1b0829cacb50a2b671f2807fe80c911c.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/1b0829cacb50a2b671f2807fe80c911c.png -------------------------------------------------------------------------------- /graphics/200px-Intersect.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/200px-Intersect.png -------------------------------------------------------------------------------- /graphics/200px-Lenna100.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/200px-Lenna100.jpg -------------------------------------------------------------------------------- /graphics/200px-Lenna50.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/200px-Lenna50.jpg -------------------------------------------------------------------------------- /graphics/200px-Plotxy-picoLisp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/200px-Plotxy-picoLisp.png -------------------------------------------------------------------------------- /graphics/20f99c880facd5566bcaaa82f09c9282.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/20f99c880facd5566bcaaa82f09c9282.png -------------------------------------------------------------------------------- /graphics/225bf69a6a0712ec19f474be5f28bd71.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/225bf69a6a0712ec19f474be5f28bd71.png -------------------------------------------------------------------------------- /graphics/250px-Huffman_coding_example.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/250px-Huffman_coding_example.jpg -------------------------------------------------------------------------------- /graphics/25e1b8e2f59974728e2a729ad51ba0bd.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/25e1b8e2f59974728e2a729ad51ba0bd.png -------------------------------------------------------------------------------- /graphics/2663fd4ac67a9a044457d845268cd7ce.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/2663fd4ac67a9a044457d845268cd7ce.png -------------------------------------------------------------------------------- /graphics/27c40c22beaf5d82e9aabf41eb7d92a2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/27c40c22beaf5d82e9aabf41eb7d92a2.png -------------------------------------------------------------------------------- /graphics/2869715b8204450d9946d9dd1966f50f.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/2869715b8204450d9946d9dd1966f50f.png -------------------------------------------------------------------------------- /graphics/2958d3ea0159c6ad2ed45f5804fce621.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/2958d3ea0159c6ad2ed45f5804fce621.png -------------------------------------------------------------------------------- /graphics/2b72903b5dd461c777da13fde57f3ebb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/2b72903b5dd461c777da13fde57f3ebb.png -------------------------------------------------------------------------------- /graphics/2cf603737e11dad8ec4d00dc8298c639.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/2cf603737e11dad8ec4d00dc8298c639.png -------------------------------------------------------------------------------- /graphics/2eb0e52a9d4ca2a57f0a0ceaca866399.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/2eb0e52a9d4ca2a57f0a0ceaca866399.png -------------------------------------------------------------------------------- /graphics/2f17435a71394ce667ab694b27341560.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/2f17435a71394ce667ab694b27341560.png -------------------------------------------------------------------------------- /graphics/31b36ed3111d6cf3e8fa29c9ef59a501.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/31b36ed3111d6cf3e8fa29c9ef59a501.png -------------------------------------------------------------------------------- /graphics/33a9aa45fa4dad1deffa8c921462ad74.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/33a9aa45fa4dad1deffa8c921462ad74.png -------------------------------------------------------------------------------- /graphics/35fc97d739522cf3dc29d28cabc2e717.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/35fc97d739522cf3dc29d28cabc2e717.png -------------------------------------------------------------------------------- /graphics/366abde6144a8e6e0d97ba03fd5cde12.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/366abde6144a8e6e0d97ba03fd5cde12.png -------------------------------------------------------------------------------- /graphics/385714f276153424a4447fa0ede31bf4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/385714f276153424a4447fa0ede31bf4.png -------------------------------------------------------------------------------- /graphics/3bd4ac77a4af3f894d8e88ed7e1ba418.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/3bd4ac77a4af3f894d8e88ed7e1ba418.png -------------------------------------------------------------------------------- /graphics/3fdf48da32bf746ea787b61406ca05e7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/3fdf48da32bf746ea787b61406ca05e7.png -------------------------------------------------------------------------------- /graphics/409b5a2625bed1a4a6c798323ae1db78.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/409b5a2625bed1a4a6c798323ae1db78.png -------------------------------------------------------------------------------- /graphics/411ee43ddd9e5b42c7ef2ddb2ec7e9fb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/411ee43ddd9e5b42c7ef2ddb2ec7e9fb.png -------------------------------------------------------------------------------- /graphics/42ca594a14ebfe0d38675336c405ca1d.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/42ca594a14ebfe0d38675336c405ca1d.png -------------------------------------------------------------------------------- /graphics/447c2e5168e15cb21cafda55903db017.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/447c2e5168e15cb21cafda55903db017.png -------------------------------------------------------------------------------- /graphics/4518ae089727239af6a569824b9b86e2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/4518ae089727239af6a569824b9b86e2.png -------------------------------------------------------------------------------- /graphics/47a50a61203b792b08a69b17c347b73f.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/47a50a61203b792b08a69b17c347b73f.png -------------------------------------------------------------------------------- /graphics/47c16228f3793455eb3436c78d21477d.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/47c16228f3793455eb3436c78d21477d.png -------------------------------------------------------------------------------- /graphics/4a4a450cda66c931dce2ee4b3b3af329.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/4a4a450cda66c931dce2ee4b3b3af329.png -------------------------------------------------------------------------------- /graphics/4b3a89ff7af9ad06700897f831201197.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/4b3a89ff7af9ad06700897f831201197.png -------------------------------------------------------------------------------- /graphics/4bcc0c5a2bb6223fa81b5bc6f0001367.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/4bcc0c5a2bb6223fa81b5bc6f0001367.png -------------------------------------------------------------------------------- /graphics/5028ac33d1b22df1c9509179c615ce6a.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/5028ac33d1b22df1c9509179c615ce6a.png -------------------------------------------------------------------------------- /graphics/520b3480cda5c9ab4ab7691ae9cdd696.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/520b3480cda5c9ab4ab7691ae9cdd696.png -------------------------------------------------------------------------------- /graphics/53bd5a42fe34b643a67c4232e71e3f99.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/53bd5a42fe34b643a67c4232e71e3f99.png -------------------------------------------------------------------------------- /graphics/54f43bb3bb190844c7989f5864df1b2a.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/54f43bb3bb190844c7989f5864df1b2a.png -------------------------------------------------------------------------------- /graphics/57270a0aaa24e849c7139b71fc5a2879.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/57270a0aaa24e849c7139b71fc5a2879.png -------------------------------------------------------------------------------- /graphics/5cec990b9d6c1fdc3b340a364729aea6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/5cec990b9d6c1fdc3b340a364729aea6.png -------------------------------------------------------------------------------- /graphics/619a49e5557ce15be15ecd45dc767c72.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/619a49e5557ce15be15ecd45dc767c72.png -------------------------------------------------------------------------------- /graphics/61a7b2eee29145e18a5583d931f62975.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/61a7b2eee29145e18a5583d931f62975.png -------------------------------------------------------------------------------- /graphics/64932f8d89d7f1750d3d40723007bd27.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/64932f8d89d7f1750d3d40723007bd27.png -------------------------------------------------------------------------------- /graphics/65027d595737121ba207f647f86dfe09.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/65027d595737121ba207f647f86dfe09.png -------------------------------------------------------------------------------- /graphics/65e69cb6ea91c1602e057eca6ef99337.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/65e69cb6ea91c1602e057eca6ef99337.png -------------------------------------------------------------------------------- /graphics/688bcacb300f8efe5d6d8f6411d13d96.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/688bcacb300f8efe5d6d8f6411d13d96.png -------------------------------------------------------------------------------- /graphics/6d547901f0a5fb3819d16aca0048b3ed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/6d547901f0a5fb3819d16aca0048b3ed.png -------------------------------------------------------------------------------- /graphics/6ecb4a72d18052ff65e393b54c3850a2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/6ecb4a72d18052ff65e393b54c3850a2.png -------------------------------------------------------------------------------- /graphics/7416c556a1ecfe80d64f32dbc9c18ae6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/7416c556a1ecfe80d64f32dbc9c18ae6.png -------------------------------------------------------------------------------- /graphics/74ad42ba372e0541d6f14058e2c33c0f.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/74ad42ba372e0541d6f14058e2c33c0f.png -------------------------------------------------------------------------------- /graphics/750px-Euler_Method_Newton_Cooling.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/750px-Euler_Method_Newton_Cooling.png -------------------------------------------------------------------------------- /graphics/79293ba1053dbc3f23c579b2e8141034.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/79293ba1053dbc3f23c579b2e8141034.png -------------------------------------------------------------------------------- /graphics/7f019c11129cbf4b99ccb7f7e110acb2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/7f019c11129cbf4b99ccb7f7e110acb2.png -------------------------------------------------------------------------------- /graphics/7f1c92a1977747914e9c5127764a9be4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/7f1c92a1977747914e9c5127764a9be4.png -------------------------------------------------------------------------------- /graphics/7f867e9ec901e62d2c8efa1ec9b4c5d6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/7f867e9ec901e62d2c8efa1ec9b4c5d6.png -------------------------------------------------------------------------------- /graphics/864ab514eca1fb4403576eb20ee0cb22.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/864ab514eca1fb4403576eb20ee0cb22.png -------------------------------------------------------------------------------- /graphics/8b92ddffc196683c9c4b2fb5f6f91d7c.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/8b92ddffc196683c9c4b2fb5f6f91d7c.png -------------------------------------------------------------------------------- /graphics/8c7f6df9ddc2c13f56a13ca113710587.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/8c7f6df9ddc2c13f56a13ca113710587.png -------------------------------------------------------------------------------- /graphics/8c943c1cc7df75afeddd50d9ad93e28e.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/8c943c1cc7df75afeddd50d9ad93e28e.png -------------------------------------------------------------------------------- /graphics/91035139969200d1af754ee0d07acd6a.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/91035139969200d1af754ee0d07acd6a.png -------------------------------------------------------------------------------- /graphics/9321b2aa2a198225b0dbe56040b49940.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/9321b2aa2a198225b0dbe56040b49940.png -------------------------------------------------------------------------------- /graphics/953f4c8f564b5ed18e1b31d2716b5f8c.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/953f4c8f564b5ed18e1b31d2716b5f8c.png -------------------------------------------------------------------------------- /graphics/981cbbc69bfa735ea07313f59feba714.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/981cbbc69bfa735ea07313f59feba714.png -------------------------------------------------------------------------------- /graphics/9df79dd98e1387bb25dc94ef7c0edcb3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/9df79dd98e1387bb25dc94ef7c0edcb3.png -------------------------------------------------------------------------------- /graphics/9eb10505118ec312428f2a4fb8b05d1f.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/9eb10505118ec312428f2a4fb8b05d1f.png -------------------------------------------------------------------------------- /graphics/Fifo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/Fifo.gif -------------------------------------------------------------------------------- /graphics/Fulladder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/Fulladder.png -------------------------------------------------------------------------------- /graphics/HEnd.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/HEnd.png -------------------------------------------------------------------------------- /graphics/Halfadder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/Halfadder.png -------------------------------------------------------------------------------- /graphics/Hidato_Start.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/Hidato_Start.png -------------------------------------------------------------------------------- /graphics/Hofstadter_conway_10K.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/Hofstadter_conway_10K.gif -------------------------------------------------------------------------------- /graphics/Hofstadter_conway_10K.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/Hofstadter_conway_10K.png -------------------------------------------------------------------------------- /graphics/NoiseOutput.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/NoiseOutput.png -------------------------------------------------------------------------------- /graphics/OpenGlRunBasic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/OpenGlRunBasic.png -------------------------------------------------------------------------------- /graphics/P92_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/P92_1.png -------------------------------------------------------------------------------- /graphics/P92_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/P92_2.png -------------------------------------------------------------------------------- /graphics/P92_3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/P92_3.png -------------------------------------------------------------------------------- /graphics/P92_4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/P92_4.png -------------------------------------------------------------------------------- /graphics/a026db06e1a9bd6945c85c8e17231725.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/a026db06e1a9bd6945c85c8e17231725.png -------------------------------------------------------------------------------- /graphics/a049527fb76c4d324e8790190e84ba28.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/a049527fb76c4d324e8790190e84ba28.png -------------------------------------------------------------------------------- /graphics/a344abb2a9a00cb2de6679a485115ce3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/a344abb2a9a00cb2de6679a485115ce3.png -------------------------------------------------------------------------------- /graphics/a404f9cdcc88e086294f604a41599f92.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/a404f9cdcc88e086294f604a41599f92.png -------------------------------------------------------------------------------- /graphics/a5e8e37e86ed379e1679034e0235bcd6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/a5e8e37e86ed379e1679034e0235bcd6.png -------------------------------------------------------------------------------- /graphics/a96e7fe6a7eb7371ab85f6a135b84056.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/a96e7fe6a7eb7371ab85f6a135b84056.png -------------------------------------------------------------------------------- /graphics/a9aea137ca2037a12d1cf6b4db76aa23.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/a9aea137ca2037a12d1cf6b4db76aa23.png -------------------------------------------------------------------------------- /graphics/ac0831ae3a81b290afe4473899785ca7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/ac0831ae3a81b290afe4473899785ca7.png -------------------------------------------------------------------------------- /graphics/af18dab590e0f994693fc34b6803c1e1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/af18dab590e0f994693fc34b6803c1e1.png -------------------------------------------------------------------------------- /graphics/af307c5e65e7403b785f8a2c6b9d051a.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/af307c5e65e7403b785f8a2c6b9d051a.png -------------------------------------------------------------------------------- /graphics/af460b7986d4afc5fe920b86f15f522a.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/af460b7986d4afc5fe920b86f15f522a.png -------------------------------------------------------------------------------- /graphics/b14d36d888dae449d5c4fcfb6f4ff8ce.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/b14d36d888dae449d5c4fcfb6f4ff8ce.png -------------------------------------------------------------------------------- /graphics/b7521c74cd98e492ade8dd3e9f40669a.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/b7521c74cd98e492ade8dd3e9f40669a.png -------------------------------------------------------------------------------- /graphics/bc37f835564eb6edd3510913644f4582.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/bc37f835564eb6edd3510913644f4582.png -------------------------------------------------------------------------------- /graphics/bdd8a535c6a8470767849ade18412c6d.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/bdd8a535c6a8470767849ade18412c6d.png -------------------------------------------------------------------------------- /graphics/c0f960b20df765fdc843e8c076225d5e.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/c0f960b20df765fdc843e8c076225d5e.png -------------------------------------------------------------------------------- /graphics/c53daded435e185afefbac417fef75e7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/c53daded435e185afefbac417fef75e7.png -------------------------------------------------------------------------------- /graphics/c7be4230ba817ec495c68f3c5fa10cfb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/c7be4230ba817ec495c68f3c5fa10cfb.png -------------------------------------------------------------------------------- /graphics/c7d9360aa57a7763c0e4764be5571c7b.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/c7d9360aa57a7763c0e4764be5571c7b.png -------------------------------------------------------------------------------- /graphics/c9f11575eec8aadcac4687458ded5aa3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/c9f11575eec8aadcac4687458ded5aa3.png -------------------------------------------------------------------------------- /graphics/cac27278c238ea97dbd86baa6afd19fe.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/cac27278c238ea97dbd86baa6afd19fe.png -------------------------------------------------------------------------------- /graphics/cd81bcd600dda401fc4cfbc6646bbbc9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/cd81bcd600dda401fc4cfbc6646bbbc9.png -------------------------------------------------------------------------------- /graphics/cf22c76e0c33c4fb96262638a28bd52b.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/cf22c76e0c33c4fb96262638a28bd52b.png -------------------------------------------------------------------------------- /graphics/copyright-cut.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/copyright-cut.png -------------------------------------------------------------------------------- /graphics/copyright-cut.xcf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/copyright-cut.xcf -------------------------------------------------------------------------------- /graphics/copyright.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/copyright.png -------------------------------------------------------------------------------- /graphics/copyright.xcf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/copyright.xcf -------------------------------------------------------------------------------- /graphics/d678d4d0af6d46165b3712e36b9718d9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/d678d4d0af6d46165b3712e36b9718d9.png -------------------------------------------------------------------------------- /graphics/d8c852f6bb73b0d042422df261390347.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/d8c852f6bb73b0d042422df261390347.png -------------------------------------------------------------------------------- /graphics/d9fa28df063d00917f713bd9de134ad5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/d9fa28df063d00917f713bd9de134ad5.png -------------------------------------------------------------------------------- /graphics/da869c8260ae3107ca34619fd2642642.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/da869c8260ae3107ca34619fd2642642.png -------------------------------------------------------------------------------- /graphics/df44347863ac17dc898a13f44f681d01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/df44347863ac17dc898a13f44f681d01.png -------------------------------------------------------------------------------- /graphics/e3a80911ae043c10931e49a6860405d6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/e3a80911ae043c10931e49a6860405d6.png -------------------------------------------------------------------------------- /graphics/e4e4d6b17e1e15dbddc307340f0a620f.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/e4e4d6b17e1e15dbddc307340f0a620f.png -------------------------------------------------------------------------------- /graphics/e5d832c5ee9a16553e635e05c2892174.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/e5d832c5ee9a16553e635e05c2892174.png -------------------------------------------------------------------------------- /graphics/ea2b3ddffa2a578dbe5d923abd914aa5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/ea2b3ddffa2a578dbe5d923abd914aa5.png -------------------------------------------------------------------------------- /graphics/ea8fba6081e51a2e4f0cd0d58c3c7032.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/ea8fba6081e51a2e4f0cd0d58c3c7032.png -------------------------------------------------------------------------------- /graphics/eae4d1b7a3788fd85e5c4995efc7e196.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/eae4d1b7a3788fd85e5c4995efc7e196.png -------------------------------------------------------------------------------- /graphics/eb1b9606546b68de1ad6063ac988df6c.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/eb1b9606546b68de1ad6063ac988df6c.png -------------------------------------------------------------------------------- /graphics/f1267a46eea12e7c046cfc7fcb859cc2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/f1267a46eea12e7c046cfc7fcb859cc2.png -------------------------------------------------------------------------------- /graphics/f6e22469b4396d8fa34e202e5c716abc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/f6e22469b4396d8fa34e202e5c716abc.png -------------------------------------------------------------------------------- /graphics/f7e030787df8cd5d0ed6dd1802306d11.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/f7e030787df8cd5d0ed6dd1802306d11.png -------------------------------------------------------------------------------- /graphics/fca99b79cfa1b2d3a65395932e824f05.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/fca99b79cfa1b2d3a65395932e824f05.png -------------------------------------------------------------------------------- /graphics/fe1a9857fd0a471baec6c538220e1bc9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/fe1a9857fd0a471baec6c538220e1bc9.png -------------------------------------------------------------------------------- /graphics/fe9a069fecbc644b6137c76e3dbe21b8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/fe9a069fecbc644b6137c76e3dbe21b8.png -------------------------------------------------------------------------------- /graphics/ff5080d5609a0b345d34544d1336e741.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/ff5080d5609a0b345d34544d1336e741.png -------------------------------------------------------------------------------- /graphics/kanji.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/kanji.png -------------------------------------------------------------------------------- /graphics/kanji.xcf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/kanji.xcf -------------------------------------------------------------------------------- /graphics/title-text-frame.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/title-text-frame.png -------------------------------------------------------------------------------- /graphics/title-text-frame.xcf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/title-text-frame.xcf -------------------------------------------------------------------------------- /graphics/title-text.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/title-text.png -------------------------------------------------------------------------------- /graphics/title-text.xcf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/graphics/title-text.xcf -------------------------------------------------------------------------------- /instructions/example.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/instructions/example.pdf -------------------------------------------------------------------------------- /instructions/figure-eps-converted-to.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/instructions/figure-eps-converted-to.pdf -------------------------------------------------------------------------------- /instructions/ftpinfo.txt: -------------------------------------------------------------------------------- 1 | Hints for transfer of the files in this directory: 2 | ================================================== 3 | When copying these files to your own computer via ftp please make sure 4 | you transfer the following formats in 5 | 6 | binary mode 7 | ----------- 8 | *.dvi 9 | *.eps 10 | *.pdf 11 | *.ps 12 | 13 | ascii mode 14 | ---------- 15 | *.cls 16 | *.ist 17 | *.sty 18 | *.tex 19 | *.txt 20 | 21 | If you have problems or further questions with respect to the file 22 | transfer please contact: 23 | 24 | Frank Holzwarth frank.holzwarth@springer.com 25 | -------------------------------------------------------------------------------- /instructions/history.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/instructions/history.txt -------------------------------------------------------------------------------- /instructions/instruct.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/instructions/instruct.pdf -------------------------------------------------------------------------------- /instructions/liesmich.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/instructions/liesmich.txt -------------------------------------------------------------------------------- /instructions/quickstart.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/instructions/quickstart.pdf -------------------------------------------------------------------------------- /instructions/readme.txt: -------------------------------------------------------------------------------- 1 | This directory holds the 8 components of the SVMono tool package: 2 | 3 | (1) a subdirectory "styles" with 4 | - the Springer document class "svmono.cls", 5 | - the Springer MakeIndex style file "svind.ist" 6 | - the Springer BibTeX styles "spbasic.bst", "spmpsci.bst", "spphys.bst" 7 | 8 | (2) a subdirectory "templates" with 9 | - the sample root file "book.tex", 10 | - the sample text files 11 | - "dedic.tex" (dedication), 12 | - "foreword.tex" (foreword), 13 | - "preface.tex" (preface), 14 | - "acknow.tex" (acknowledgements), 15 | - "acronym.tex" (list of acronyms), 16 | - "part.tex" (part title), 17 | - "chapter.tex" (chapter), 18 | - "appendix.tex" (appendix), 19 | - "glossary.tex" (glossary), 20 | - "solutions.tex" (solutions chapter), 21 | - "referenc.tex" (references), 22 | - "figure.eps" (sample figure), 23 | with preset class options, packages and coding examples; 24 | 25 | Tip: Copy all these files to your working directory, run LaTeX 26 | and produce your own example *.dvi file; rename the template files as 27 | you see fit and use them for your own input. 28 | 29 | (3) the pdf file "quickstart.pdf" with "essentials" for 30 | an easy implementation of the "svmono" package (2 pages) 31 | 32 | (4) the pdf file "instruct.pdf" with style and 33 | coding instructions specific to -- Monographs -- 34 | 35 | Tip: Follow these instructions to set up your files, 36 | to type in your text and to obtain a consistent formal style; 37 | use these pages as checklists before you submit 38 | your ready-to-print manuscript. 39 | 40 | (5) the pdf file "refguide.pdf" describing the 41 | SVMono document class features independent of any specific style 42 | requirements. 43 | 44 | Tip: Use it as a reference if you need to alter or 45 | enhance the default settings of the SVMono document 46 | class and/or the templates. 47 | 48 | (6) the pdf file "example.pdf" 49 | 50 | (7) a subdirectory "deutsch" with 51 | - instructions for writing german texts 52 | 53 | (8) a file "history.txt" with version history 54 | -------------------------------------------------------------------------------- /instructions/referenc.tex: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/instructions/referenc.tex -------------------------------------------------------------------------------- /instructions/refguide.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/instructions/refguide.pdf -------------------------------------------------------------------------------- /mainmatter/function-ref-B.tex: -------------------------------------------------------------------------------- 1 | %%%%%%%%%%%%%%%%%%%%% chapter.tex %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2 | % 3 | % sample chapter 4 | % 5 | % Use this file as a template for your own input. 6 | % 7 | %%%%%%%%%%%%%%%%%%%%%%%% Springer-Verlag %%%%%%%%%%%%%%%%%%%%%%%%%% 8 | %\motto{Use the template \emph{chapter.tex} to style the various elements of your chapter content.} 9 | 10 | \chapter{Symbols starting with B} 11 | \label{cha:funct-ref-B-symbols-starting-B} 12 | 13 | \section*{\texttt{*Blob}} 14 | \label{sec:funct-ref-B-*blob} 15 | 16 | 17 | A global variable holding the pathname of the database blob directory. 18 | See also \texttt{blob}. 19 | 20 | 21 | \begin{wideverbatim} 22 | : *Blob 23 | -> "blob/app/" 24 | \end{wideverbatim} 25 | 26 | 27 | \section*{\texttt{*Bye}} 28 | \label{sec:funct-ref-B-*bye} 29 | 30 | 31 | A global variable holding a (possibly empty) \texttt{prg} body, to be executed 32 | just before the termination of the PicoLisp interpreter. See also \texttt{bye} 33 | and \texttt{tmp}. 34 | 35 | 36 | \begin{wideverbatim} 37 | : (push1 '*Bye '(call 'rm "myfile.tmp")) # Remove a temporary file 38 | -> (call 'rm "myfile.tmp") 39 | \end{wideverbatim} 40 | 41 | 42 | \section*{\texttt{+Bag}} 43 | \label{sec:funct-ref-B-+bag} 44 | 45 | 46 | Class for a list of arbitrary relations, a subclass of \texttt{+relation}. 47 | Objects of that class maintain a list of heterogeneous relations. 48 | Typically used in combination with the \texttt{+List} prefix class, to maintain 49 | small two-dimensional tables within oubjects. See also \texttt{Database}. 50 | 51 | 52 | \begin{wideverbatim} 53 | (rel pos (+List +Bag) # Positions 54 | ((+Ref +Link) NIL (+Item)) # Item 55 | ((+Number) 2) # Price 56 | ((+Number)) # Quantity 57 | ((+String)) # Memo text 58 | ((+Number) 2) ) # Total amount 59 | \end{wideverbatim} 60 | 61 | 62 | \section*{\texttt{+Blob}} 63 | \label{sec:funct-ref-B-+blob} 64 | 65 | 66 | Class for blob relations, a subclass of \texttt{+relation}. Objects of that 67 | class maintain blobs, as stubs in database objects pointing to actual 68 | files for arbitrary (often binary) data. The files themselves reside 69 | below the path specified by the \texttt{*Blob} variable. See also \texttt{Database}. 70 | 71 | 72 | \begin{wideverbatim} 73 | (rel jpg (+Blob)) # Picture 74 | \end{wideverbatim} 75 | 76 | 77 | \section*{\texttt{+Bool}} 78 | \label{sec:funct-ref-B-+bool} 79 | 80 | Class for boolean relations, a subclass of \texttt{+relation}. Objects of that 81 | class expect either \texttt{T} or \texttt{NIL} as value (though, as always, only 82 | non-\texttt{NIL} will be physically stored in objects). See also \texttt{Database}. 83 | 84 | 85 | \begin{wideverbatim} 86 | (rel ok (+Ref +Bool)) # Indexed flag 87 | \end{wideverbatim} 88 | 89 | 90 | \section*{\texttt{(balance 'var 'lst ['flg])}} 91 | \label{sec:funct-ref-B-(balance-'var-'lst-['flg])} 92 | 93 | 94 | Builds a balanced binary \texttt{idx} tree in \texttt{var}, from the sorted list in 95 | \texttt{lst}. Normally (if random or, in the worst case, ordered data) are 96 | inserted with \texttt{idx}, the tree will not be balanced. But if \texttt{lst} is 97 | properly sorted, its contents will be inserted in an optimally balanced 98 | way. If \texttt{flg} is non-\texttt{NIL}, the index tree will be augmented instead of 99 | being overwritten. See also \texttt{Comparing} and \texttt{sort}. 100 | 101 | 102 | \begin{wideverbatim} 103 | # Normal idx insert 104 | : (off I) 105 | -> NIL 106 | : (for X (1 4 2 5 3 6 7 9 8) (idx 'I X T)) 107 | -> NIL 108 | : (depth I) 109 | -> 7 110 | 111 | # Balanced insert 112 | : (balance 'I (sort (1 4 2 5 3 6 7 9 8))) 113 | -> NIL 114 | : (depth I) 115 | -> 4 116 | 117 | # Augment 118 | : (balance 'I (sort (10 40 20 50 30 60 70 90 80)) T) 119 | -> NIL 120 | : (idx 'I) 121 | -> (1 2 3 4 5 6 7 8 9 10 20 30 40 50 60 70 80 90) 122 | \end{wideverbatim} 123 | 124 | 125 | \section*{\texttt{(basename 'any) -> sym}} 126 | \label{sec:funct-ref-B-(basename-'any)-->-sym} 127 | 128 | 129 | Returns the filename part of a path name \texttt{any}. See also \texttt{dirname} and 130 | \texttt{path}. 131 | 132 | 133 | \begin{wideverbatim} 134 | : (basename "a/b/c/d") 135 | -> "d" 136 | \end{wideverbatim} 137 | 138 | 139 | \section*{\texttt{(be sym . any) -> sym}} 140 | \label{sec:funct-ref-B-(be-sym-.-any)-->-sym} 141 | 142 | 143 | Declares a \hyperref[ref.html-pilog]{Pilog} fact or rule for the \texttt{sym} 144 | argument, by concatenating the \texttt{any} argument to the \texttt{T} property of 145 | \texttt{sym}. See also \texttt{clause}, \texttt{asserta}, \texttt{assertz}, \texttt{retract}, \texttt{goal} and 146 | \texttt{prove}. 147 | 148 | 149 | \begin{wideverbatim} 150 | : (be likes (John Mary)) 151 | -> likes 152 | : (be likes (John @X) (likes @X wine) (likes @X food)) 153 | -> likes 154 | : (get 'likes T) 155 | -> (((John Mary)) ((John @X) (likes @X wine) (likes @X food))) 156 | : (? (likes John @X)) 157 | @X=Mary 158 | -> NIL 159 | \end{wideverbatim} 160 | 161 | 162 | \section*{\texttt{(beep) -> any}} 163 | \label{sec:funct-ref-B-(beep)-->-any} 164 | 165 | 166 | Send the bell character to the console. See also \texttt{prin} and \texttt{char}. 167 | 168 | 169 | \begin{wideverbatim} 170 | : (beep) 171 | -> "^G" 172 | \end{wideverbatim} 173 | 174 | 175 | \section*{\texttt{(bench . prg) -> any}} 176 | \label{sec:funct-ref-B-(bench-.-prg)-->-any} 177 | 178 | 179 | Benchmarks \texttt{prg}, by printing the time it took to execute, and returns 180 | the result. See also \texttt{usec}. 181 | 182 | 183 | \begin{wideverbatim} 184 | : (bench (wait 2000)) 185 | 1.996 sec 186 | -> NIL 187 | \end{wideverbatim} 188 | 189 | 190 | \section*{\texttt{(bin 'num ['num]) -> sym}} 191 | \label{sec:funct-ref-B-(bin-'num-['num])-->-sym} 192 | 193 | 194 | \texttt{(bin 'sym) -> num} 195 | 196 | Converts a number \texttt{num} to a binary string, or a binary string \texttt{sym} to 197 | a number. In the first case, if the second argument is given, the result 198 | is separated by spaces into groups of such many digits. See also \texttt{oct}, 199 | \texttt{hex}, \texttt{fmt64}, \texttt{hax} and \texttt{format}. 200 | 201 | 202 | \begin{wideverbatim} 203 | : (bin 73) 204 | -> "1001001" 205 | : (bin "1001001") 206 | -> 73 207 | : (bin 1234567 4) 208 | -> "100 1011 0101 1010 0001 11" 209 | \end{wideverbatim} 210 | 211 | 212 | \section*{\texttt{(bind 'sym|lst . prg) -> any}} 213 | \label{sec:funct-ref-B-(bind-'sym|lst-.-prg)-->-any} 214 | 215 | 216 | Binds value(s) to symbol(s). The first argument must evaluate to a 217 | symbol, or a list of symbols or symbol-value pairs. The values of these 218 | symbols are saved (and the symbols bound to the values in the case of 219 | pairs), \texttt{prg} is executed, then the symbols are restored to their 220 | original values. During execution of \texttt{prg}, the values of the symbols 221 | can be temporarily modified. The return value is the result of \texttt{prg}. 222 | See also \texttt{let}, \texttt{job} and \texttt{use}. 223 | 224 | 225 | \begin{wideverbatim} 226 | : (setq X 123) # X is 123 227 | -> 123 228 | : (bind 'X (setq X "Hello") (println X)) # Set X to "Hello", print it 229 | "Hello" 230 | -> "Hello" 231 | : (bind '((X . 3) (Y . 4)) (println X Y) (* X Y)) 232 | 3 4 233 | -> 12 234 | : X 235 | -> 123 # X is restored to 123 236 | \end{wideverbatim} 237 | 238 | 239 | \section*{\texttt{(bit? 'num ..) -> num | NIL}} 240 | \label{sec:funct-ref-B-(bit?-'num-..)-->-num-|-nil} 241 | 242 | 243 | Returns the first \texttt{num} argument when all bits which are 1 in the first 244 | argument are also 1 in all following arguments, otherwise \texttt{NIL}. When 245 | one of those arguments evaluates to \texttt{NIL}, it is returned immediately. 246 | See also \texttt{\&}, \texttt{|} and \texttt{x|}. 247 | 248 | 249 | \begin{wideverbatim} 250 | : (bit? 7 15 255) 251 | -> 7 252 | : (bit? 1 3) 253 | -> 1 254 | : (bit? 1 2) 255 | -> NIL 256 | \end{wideverbatim} 257 | 258 | 259 | \section*{\texttt{(blob 'obj 'sym) -> sym}} 260 | \label{sec:funct-ref-B-(blob-'obj-'sym)-->-sym} 261 | 262 | 263 | Returns the blob file name for \texttt{var} in \texttt{obj}. See also \texttt{*Blob}, \texttt{blob!} 264 | and \texttt{pack}. 265 | 266 | 267 | \begin{wideverbatim} 268 | : (show (db 'nr '+Item 1)) 269 | {3-1} (+Item) 270 | jpg 271 | pr 29900 272 | inv 100 273 | sup {2-1} 274 | nm "Main Part" 275 | nr 1 276 | -> {3-1} 277 | : (blob '{3-1} 'jpg) 278 | -> "blob/app/3/-/1.jpg" 279 | \end{wideverbatim} 280 | 281 | 282 | \section*{\texttt{(blob! 'obj 'sym 'file)}} 283 | \label{sec:funct-ref-B-(blob!-'obj-'sym-'file)} 284 | 285 | 286 | Stores the contents of \texttt{file} in a \texttt{blob}. See also \texttt{put!>}. 287 | 288 | 289 | \begin{wideverbatim} 290 | (blob! *ID 'jpg "picture.jpg") 291 | \end{wideverbatim} 292 | 293 | 294 | \section*{\texttt{(bool 'any) -> flg}} 295 | \label{sec:funct-ref-B-(bool-'any)-->-flg} 296 | 297 | 298 | Returns \texttt{T} when the argument \texttt{any} is non-\texttt{NIL}. This function is only 299 | needed when \texttt{T} is strictly required for a ``true'' condition (Usually, 300 | any non-\texttt{NIL} value is considered to be ``true''). See also \texttt{flg?}. 301 | 302 | 303 | \begin{wideverbatim} 304 | : (and 3 4) 305 | -> 4 306 | : (bool (and 3 4)) 307 | -> T 308 | \end{wideverbatim} 309 | 310 | 311 | \section*{\texttt{bool/3}} 312 | \label{sec:funct-ref-B-bool/3} 313 | 314 | 315 | \hyperref[ref.html-pilog]{Pilog} predicate that succeeds if the first argument 316 | has the same truth value as the result of applying the \texttt{get} algorithm 317 | to the following arguments. Typically used as filter predicate in 318 | \texttt{select/3} database queries. See also \texttt{bool}, \texttt{isa/2}, \texttt{same/3}, 319 | \texttt{range/3}, \texttt{head/3}, \texttt{fold/3}, \texttt{part/3} and \texttt{tolr/3}. 320 | 321 | 322 | \begin{wideverbatim} 323 | : (? @OK NIL # Find orders where the 'ok' flag is not set 324 | (db nr +Ord @Ord) 325 | (bool @OK @Ord ok) ) 326 | @OK=NIL @Ord={3-7} 327 | -> NIL 328 | \end{wideverbatim} 329 | 330 | 331 | \section*{\texttt{(box 'any) -> sym}} 332 | \label{sec:funct-ref-B-(box-'any)-->-sym} 333 | 334 | 335 | Creates and returns a new anonymous symbol. The initial value is set to 336 | the \texttt{any} argument. See also \texttt{new} and \texttt{box?}. 337 | 338 | 339 | \begin{wideverbatim} 340 | : (show (box '(A B C))) 341 | $134425627 (A B C) 342 | -> $134425627 343 | \end{wideverbatim} 344 | 345 | 346 | \section*{\texttt{(box? 'any) -> sym | NIL}} 347 | \label{sec:funct-ref-B-(box?-'any)-->-sym-|-nil} 348 | 349 | 350 | Returns the argument \texttt{any} when it is an anonymous symbol, otherwise 351 | \texttt{NIL}. See also \texttt{box}, \texttt{str?} and \texttt{ext?}. 352 | 353 | 354 | \begin{wideverbatim} 355 | : (box? (new)) 356 | -> $134563468 357 | : (box? 123) 358 | -> NIL 359 | : (box? 'a) 360 | -> NIL 361 | : (box? NIL) 362 | -> NIL 363 | \end{wideverbatim} 364 | 365 | 366 | \section*{\texttt{(by 'fun1 'fun2 'lst ..) -> lst}} 367 | \label{sec:funct-ref-B-(by-'fun1-'fun2-'lst-..)-->-lst} 368 | 369 | 370 | Applies \texttt{fun1} to each element of \texttt{lst}. When additional \texttt{lst} arguments 371 | are given, their elements are also passed to \texttt{fun1}. Each result of 372 | \texttt{fun1} is CONSed with its corresponding argument form the original 373 | \texttt{lst}, and collected into a list which is passed to \texttt{fun2}. For the list 374 | returned from \texttt{fun2}, the CAR elements returned by \texttt{fun1} are 375 | (destructively) removed from each element. 376 | 377 | 378 | \begin{wideverbatim} 379 | : (let (A 1 B 2 C 3) (by val sort '(C A B))) 380 | -> (A B C) 381 | : (by '((N) (bit? 1 N)) group (3 11 6 2 9 5 4 10 12 7 8 1)) 382 | -> ((3 11 9 5 7 1) (6 2 4 10 12 8)) 383 | \end{wideverbatim} 384 | 385 | 386 | \section*{(bye 'cnt|NIL)}} 387 | \label{sec:funct-ref-B-(bye-'cnt|nil)} 388 | 389 | 390 | Executes all pending \texttt{finally} expressions, closes all open files, 391 | executes the \texttt{VAL} of the global variable \texttt{*Bye} (should be a \texttt{prg}), 392 | flushes standard output, and then exits the PicoLisp interpreter. The 393 | process return value is \texttt{cnt}, or 0 if the argument is missing or \texttt{NIL}. 394 | 395 | 396 | \begin{wideverbatim} 397 | : (setq *Bye '((println 'OK) (println 'bye))) 398 | -> ((println 'OK) (println 'bye)) 399 | : (bye) 400 | OK 401 | bye 402 | $ 403 | \end{wideverbatim} 404 | 405 | -------------------------------------------------------------------------------- /mainmatter/function-ref-G.tex: -------------------------------------------------------------------------------- 1 | %%%%%%%%%%%%%%%%%%%%% chapter.tex %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2 | % 3 | % sample chapter 4 | % 5 | % Use this file as a template for your own input. 6 | % 7 | %%%%%%%%%%%%%%%%%%%%%%%% Springer-Verlag %%%%%%%%%%%%%%%%%%%%%%%%%% 8 | %\motto{Use the template \emph{chapter.tex} to style the various elements of your chapter content.} 9 | 10 | 11 | 12 | \chapter{Symbols starting with G} 13 | \label{sec:func-ref-G-} 14 | 15 | 16 | 17 | \section*{\texttt{(gc ['cnt]) -> cnt | NIL}} 18 | \label{sec:func-ref-G-(gc ['cnt]) -> cnt | NIL} 19 | 20 | 21 | Forces a garbage collection. When \texttt{cnt} is given, so many megabytes of 22 | free cells are reserved, increasing the heap size if necessary. If \texttt{cnt} 23 | is zero, all currently unused heap blocks are purged, decreasing the 24 | heap size if possible. See also \texttt{heap}. 25 | 26 | 27 | \begin{wideverbatim} 28 | : (gc) 29 | -> NIL 30 | : (heap) 31 | -> 2 32 | : (gc 4) 33 | -> 4 34 | : (heap) 35 | -> 5 36 | \end{wideverbatim} 37 | 38 | 39 | \section*{\texttt{(ge0 'any) -> num | NIL}} 40 | \label{sec:func-ref-G-(ge0 'any) -> num | NIL} 41 | 42 | 43 | Returns \texttt{num} when the argument is a number and greater or equal zero, 44 | otherwise \texttt{NIL}. See also \texttt{lt0}, \texttt{le0}, \texttt{gt0}, \texttt{=0} and \texttt{n0}. 45 | 46 | 47 | \begin{wideverbatim} 48 | : (ge0 -2) 49 | -> NIL 50 | : (ge0 3) 51 | -> 3 52 | : (ge0 0) 53 | -> 0 54 | \end{wideverbatim} 55 | 56 | 57 | \section*{\texttt{(genKey 'var 'cls ['hook ['num1 ['num2]]]) -> num}} 58 | \label{sec:func-ref-G-(genKey 'var 'cls ['hook ['num1 ['num2]]]) -> num} 59 | 60 | 61 | Generates a key for a database tree. If a minimal key \texttt{num1} and/or a 62 | maximal key \texttt{num2} is given, the next free number in that range is 63 | returned. Otherwise, the current maximal key plus one is returned. See 64 | also \texttt{useKey}, \texttt{genStrKey} and \texttt{maxKey}. 65 | 66 | 67 | \begin{wideverbatim} 68 | : (maxKey (tree 'nr '+Item)) 69 | -> 8 70 | : (genKey 'nr '+Item) 71 | -> 9 72 | \end{wideverbatim} 73 | 74 | 75 | \section*{\texttt{(genStrKey 'sym 'var 'cls ['hook]) -> sym}} 76 | \label{sec:func-ref-G-(genStrKey 'sym 'var 'cls ['hook]) -> sym} 77 | 78 | 79 | Generates a unique string for a database tree, by prepending as many ``\#'' 80 | sequences as necessary. See also \texttt{genKey}. 81 | 82 | 83 | \begin{wideverbatim} 84 | : (genStrKey "ben" 'nm '+User) 85 | -> "# ben" 86 | \end{wideverbatim} 87 | 88 | 89 | \section*{\texttt{(get 'sym1|lst ['sym2|cnt ..]) -> any}} 90 | \label{sec:func-ref-G-(get 'sym1|lst ['sym2|cnt ..]) -> any} 91 | 92 | 93 | Fetches a value \texttt{any} from the properties of a symbol, or from a list. 94 | From the first argument \texttt{sym1|lst}, values are retrieved in successive 95 | steps by either extracting the value (if the next argument is zero) or a 96 | property from a symbol, the \texttt{asoq}ed element (if the next argument is a 97 | symbol), the n'th element (if the next argument is a positive number) or 98 | the n'th CDR (if the next argument is a negative number) from a list. 99 | See also \texttt{put}, \texttt{;} and \texttt{:}. 100 | 101 | 102 | \begin{wideverbatim} 103 | : (put 'X 'a 1) 104 | -> 1 105 | : (get 'X 'a) 106 | -> 1 107 | : (put 'Y 'link 'X) 108 | -> X 109 | : (get 'Y 'link) 110 | -> X 111 | : (get 'Y 'link 'a) 112 | -> 1 113 | : (get '((a (b . 1) (c . 2)) (d (e . 3) (f . 4))) 'a 'b) 114 | -> 1 115 | : (get '((a (b . 1) (c . 2)) (d (e . 3) (f . 4))) 'd 'f) 116 | -> 4 117 | : (get '(X Y Z) 2) 118 | -> Y 119 | : (get '(X Y Z) 2 'link 'a) 120 | -> 1 121 | \end{wideverbatim} 122 | 123 | 124 | \section*{\texttt{(getd 'any) -> fun | NIL}} 125 | \label{sec:func-ref-G-(getd 'any) -> fun | NIL} 126 | 127 | 128 | Returns \texttt{fun} if \texttt{any} is a symbol that has a function definition, 129 | otherwise \texttt{NIL}. See also \texttt{fun?}. 130 | 131 | 132 | \begin{wideverbatim} 133 | : (getd '+) 134 | -> 67327232 135 | : (getd 'script) 136 | -> ((File . @) (load File)) 137 | : (getd 1) 138 | -> NIL 139 | \end{wideverbatim} 140 | 141 | 142 | \section*{\texttt{(getl 'sym1|lst1 ['sym2|cnt ..]) -> lst}} 143 | \label{sec:func-ref-G-(getl 'sym1|lst1 ['sym2|cnt ..]) -> lst} 144 | 145 | 146 | Fetches the complete property list \texttt{lst} from a symbol. That symbol is 147 | \texttt{sym1} (if no other arguments are given), or a symbol found by applying 148 | the \texttt{get} algorithm to \texttt{sym1|lst1} and the following arguments. See also 149 | \texttt{putl} and \texttt{maps}. 150 | 151 | 152 | \begin{wideverbatim} 153 | : (put 'X 'a 1) 154 | -> 1 155 | : (put 'X 'b 2) 156 | -> 2 157 | : (put 'X 'flg T) 158 | -> T 159 | : (getl 'X) 160 | -> (flg (2 . b) (1 . a)) 161 | \end{wideverbatim} 162 | 163 | 164 | \section*{\texttt{(glue 'any 'lst) -> sym}} 165 | \label{sec:func-ref-G-(glue 'any 'lst) -> sym} 166 | 167 | 168 | Builds a new transient symbol (string) by \texttt{pack}ing the 169 | \texttt{any} argument between the individual elements of \texttt{lst}. 170 | See also \texttt{text}. 171 | 172 | 173 | \begin{wideverbatim} 174 | : (glue "," '(a b c d)) 175 | -> "a,b,c,d" 176 | \end{wideverbatim} 177 | 178 | 179 | \section*{\texttt{(goal '([pat 'any ..] . lst) ['sym 'any ..]) -> lst}} 180 | \label{sec:func-ref-G-(goal '([pat 'any ..] . lst) ['sym 'any ..]) -> lst} 181 | 182 | 183 | Constructs a \emph{Pilog} query list from the list of 184 | clauses \texttt{lst}. The head of the argument list may consist of a sequence 185 | of pattern symbols (Pilog variables) and expressions, which are used 186 | together with the optional \texttt{sym} and \texttt{any} arguments to form an initial 187 | environment. See also \texttt{prove} and \texttt{fail}. 188 | 189 | 190 | \begin{wideverbatim} 191 | : (goal '((likes John @X))) 192 | -> (((1 (0) NIL ((likes John @X)) NIL T))) 193 | : (goal '(@X 'John (likes @X @Y))) 194 | -> (((1 (0) NIL ((likes @X @Y)) NIL ((0 . @X) 1 . John) T))) 195 | \end{wideverbatim} 196 | 197 | 198 | \section*{\texttt{(group 'lst) -> lst}} 199 | \label{sec:func-ref-G-(group 'lst) -> lst} 200 | 201 | 202 | Builds a list of lists, by grouping all elements of \texttt{lst} with the same 203 | CAR into a common sublist. See also \emph{Comparing}, \texttt{by}, 204 | \texttt{sort} and \texttt{uniq}. 205 | 206 | 207 | \begin{wideverbatim} 208 | : (group '((1 . a) (1 . b) (1 . c) (2 . d) (2 . e) (2 . f))) 209 | -> ((1 a b c) (2 d e f)) 210 | : (by name group '("x" "x" "y" "z" "x" "z"))) 211 | -> (("x" "x" "x") ("y") ("z" "z")) 212 | : (by length group '(123 (1 2) "abcd" "xyz" (1 2 3 4) "XY")) 213 | -> ((123 "xyz") ((1 2) "XY") ("abcd" (1 2 3 4)) 214 | \end{wideverbatim} 215 | 216 | 217 | \section*{\texttt{(gt0 'any) -> num | NIL}} 218 | \label{sec:func-ref-G-(gt0 'any) -> num | NIL} 219 | 220 | 221 | Returns \texttt{num} when the argument is a number and greater than 222 | zero, otherwise \texttt{NIL}. See also \texttt{lt0}, \texttt{le0}, 223 | \texttt{ge0}, \texttt{=0} and \texttt{n0}. 224 | 225 | 226 | \begin{wideverbatim} 227 | : (gt0 -2) 228 | -> NIL 229 | : (gt0 3) 230 | -> 3 231 | \end{wideverbatim} 232 | 233 | 234 | 235 | 236 | % \input{referenc} 237 | -------------------------------------------------------------------------------- /mainmatter/function-ref-H.tex: -------------------------------------------------------------------------------- 1 | %%%%%%%%%%%%%%%%%%%%% chapter.tex %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2 | % 3 | % sample chapter 4 | % 5 | % Use this file as a template for your own input. 6 | % 7 | %%%%%%%%%%%%%%%%%%%%%%%% Springer-Verlag %%%%%%%%%%%%%%%%%%%%%%%%%% 8 | %\motto{Use the template \emph{chapter.tex} to style the various elements of your chapter content.} 9 | 10 | 11 | 12 | \chapter{Symbols starting with H} 13 | \label{cha:func-ref-H-functions-starting-with-H} 14 | 15 | 16 | \section*{\texttt{*Hup}} 17 | \label{sec:func-ref-H-*Hup} 18 | 19 | 20 | Global variable holding a (possibly empty) \texttt{prg} body, which will be 21 | executed when a SIGHUP signal is sent to the current process. See also 22 | \texttt{alarm}, \texttt{sigio} and \texttt{*Sig[12]}. 23 | 24 | 25 | \begin{wideverbatim} 26 | : (de *Hup (msg 'SIGHUP)) 27 | -> *Hup 28 | \end{wideverbatim} 29 | 30 | 31 | \section*{\texttt{+Hook}} 32 | \label{sec:func-ref-H-+Hook} 33 | 34 | 35 | Prefix class for \texttt{+relation}s, typically \texttt{+Link} or 36 | \texttt{+Joint}. In essence, this maintains an local database in the 37 | referred object. See also \texttt{Database}. 38 | 39 | 40 | \begin{wideverbatim} 41 | (rel sup (+Hook +Link) (+Sup)) # Supplier 42 | (rel nr (+Key +Number) sup) # Item number, unique per supplier 43 | (rel dsc (+Ref +String) sup) # Item description, indexed per supplier 44 | \end{wideverbatim} 45 | 46 | 47 | \section*{\texttt{(hash 'any) -> cnt}} 48 | \label{sec:func-ref-H-(hash 'any) -> cnt} 49 | 50 | 51 | Generates a 16-bit number (1--65536) from \texttt{any}, suitable as a hash 52 | value for various purposes, like randomly balanced \texttt{idx} structures. See 53 | also \texttt{cache} and \texttt{seed}. 54 | 55 | 56 | \begin{wideverbatim} 57 | : (hash 0) 58 | -> 1 59 | : (hash 1) 60 | -> 55682 61 | : (hash "abc") 62 | -> 45454 63 | \end{wideverbatim} 64 | 65 | 66 | \section*{\texttt{(hax 'num) -> sym}} 67 | \label{sec:func-ref-H-(hax 'num) -> sym} 68 | 69 | 70 | \texttt{(hax 'sym) -> num} 71 | 72 | Converts a number \texttt{num} to a string in hexadecimal/alpha 73 | notation, or a hexadecimal/alpha formatted string to a number. The 74 | digits are represented with `\texttt{@}' (zero) and the letters 75 | `\texttt{A}' - `\texttt{O}' (from ``alpha'' to ``omega''). This format 76 | is used internally for the names of \texttt{external symbols} in the 77 | 64-bit version. See also \texttt{fmt64}, \texttt{hex}, \texttt{bin} 78 | and \texttt{oct}. 79 | 80 | 81 | \begin{wideverbatim} 82 | : (hax 7) 83 | -> "G" 84 | : (hax 16) 85 | -> "A@" 86 | : (hax 255) 87 | -> "OO" 88 | : (hax "A") 89 | -> 1 90 | \end{wideverbatim} 91 | 92 | 93 | \section*{\texttt{(hd 'sym ['cnt]) -> NIL}} 94 | \label{sec:func-ref-H-(hd 'sym ['cnt]) -> NIL} 95 | 96 | 97 | Displays a hexadecimal dump of the file given by \texttt{sym}, limited to \texttt{cnt} 98 | lines. See also \texttt{proc}. 99 | 100 | 101 | \begin{wideverbatim} 102 | : (hd "lib.l" 4) 103 | 00000000 23 20 32 33 64 65 63 30 39 61 62 75 0A 23 20 28 # 23dec09abu.# ( 104 | 00000010 63 29 20 53 6F 66 74 77 61 72 65 20 4C 61 62 2E c) Software Lab. 105 | 00000020 20 41 6C 65 78 61 6E 64 65 72 20 42 75 72 67 65 Alexander Burge 106 | 00000030 72 0A 0A 28 64 65 20 74 61 73 6B 20 28 4B 65 79 r..(de task (Key 107 | -> NIL 108 | \end{wideverbatim} 109 | 110 | 111 | \section*{\texttt{(head 'cnt|lst 'lst) -> lst}} 112 | \label{sec:func-ref-H-(head 'cnt|lst 'lst) -> lst} 113 | 114 | 115 | Returns a new list made of the first \texttt{cnt} elements of \texttt{lst}. If \texttt{cnt} 116 | is negative, it is added to the length of \texttt{lst}. If the first argument 117 | is a \texttt{lst}, \texttt{head} is a predicate function returning that argument list 118 | if it is \texttt{equal} to the head of the second argument, and \texttt{NIL} 119 | otherwise. See also \texttt{tail}. 120 | 121 | 122 | \begin{wideverbatim} 123 | : (head 3 '(a b c d e f)) 124 | -> (a b c) 125 | : (head 0 '(a b c d e f)) 126 | -> NIL 127 | : (head 10 '(a b c d e f)) 128 | -> (a b c d e f) 129 | : (head -2 '(a b c d e f)) 130 | -> (a b c d) 131 | : (head '(a b c) '(a b c d e f)) 132 | -> (a b c) 133 | \end{wideverbatim} 134 | 135 | 136 | \section*{\texttt{head/3}} 137 | \label{sec:func-ref-H-head/3} 138 | 139 | 140 | \emph{Pilog} predicate that succeeds if the first (string) 141 | argument is a prefix of the string representation of the result of 142 | applying the \texttt{get} algorithm to the following arguments. Typically used 143 | as filter predicate in \texttt{select/3} database queries. See also \texttt{pre?}, 144 | \texttt{isa/2}, \texttt{same/3}, \texttt{bool/3}, \texttt{range/3}, \texttt{fold/3}, \texttt{part/3} and \texttt{tolr/3}. 145 | 146 | 147 | \begin{wideverbatim} 148 | : (? 149 | @Nm "Muller" 150 | @Tel "37" 151 | (select (@CuSu) 152 | ((nm +CuSu @Nm) (tel +CuSu @Tel)) 153 | (tolr @Nm @CuSu nm) 154 | (head @Tel @CuSu tel) ) 155 | (val @Name @CuSu nm) 156 | (val @Phone @CuSu tel) ) 157 | @Nm="Muller" @Tel="37" @CuSu={2-3} @Name="Miller" @Phone="37 4773 82534" 158 | -> NIL 159 | \end{wideverbatim} 160 | 161 | 162 | \section*{\texttt{(heap 'flg) -> cnt}} 163 | \label{sec:func-ref-H-(heap 'flg) -> cnt} 164 | 165 | 166 | Returns the total size of the cell heap space in megabytes. If \texttt{flg} is 167 | non-\texttt{NIL}, the size of the currently free space is returned. See also 168 | \texttt{stack} and \texttt{gc}. 169 | 170 | 171 | \begin{wideverbatim} 172 | : (gc 4) 173 | -> 4 174 | : (heap) 175 | -> 5 176 | : (heap T) 177 | -> 4 178 | \end{wideverbatim} 179 | 180 | 181 | \section*{\texttt{(hear 'cnt) -> cnt}} 182 | \label{sec:func-ref-H-(hear 'cnt) -> cnt} 183 | 184 | 185 | Uses the file descriptor \texttt{cnt} as an asynchronous command input channel. 186 | Any executable list received via this channel will be executed in the 187 | background. As this mechanism is also used for inter-family 188 | communication (see \texttt{tell}), \texttt{hear} is usually only called explicitly by 189 | a top level parent process. 190 | 191 | 192 | \begin{wideverbatim} 193 | : (call 'mkfifo "fifo/cmd") 194 | -> T 195 | : (hear (open "fifo/cmd")) 196 | -> 3 197 | \end{wideverbatim} 198 | 199 | 200 | \section*{\texttt{(here ['sym]) -> sym}} 201 | \label{sec:func-ref-H-(here ['sym]) -> sym} 202 | 203 | 204 | Echoes the current input stream until \texttt{sym} is encountered, or until end 205 | of file. See also \texttt{echo}. 206 | 207 | 208 | \begin{wideverbatim} 209 | $ cat hello.l 210 | (html 0 "Hello" "lib.css" NIL 211 | (

NIL "Hello") 212 | (here) ) 213 |

Hello!

214 |

This is a test.

215 | 216 | $ pil @lib/http.l @lib/xhtml.l hello.l 217 | HTTP/1.0 200 OK 218 | Server: PicoLisp 219 | Date: Sun, 03 Jun 2007 11:41:27 GMT 220 | Cache-Control: max-age=0n 221 | Cache-Control: no-cache 222 | Content-Type: text/html; charset=utf-8 223 | 224 | 226 | 227 | 228 | Hello 229 | 230 | 231 |

Hello

232 |

Hello!

233 |

This is a test.

234 | 235 | 236 | \end{wideverbatim} 237 | 238 | 239 | \section*{\texttt{(hex 'num ['num]) -> sym}} 240 | \label{sec:func-ref-H-(hex 'num ['num]) -> sym} 241 | 242 | 243 | \texttt{(hex 'sym) -> num} 244 | 245 | Converts a number \texttt{num} to a hexadecimal string, or a hexadecimal string 246 | \texttt{sym} to a number. In the first case, if the second argument is given, 247 | the result is separated by spaces into groups of such many digits. See 248 | also \texttt{bin}, \texttt{oct}, \texttt{fmt64}, \texttt{hax} and \texttt{format}. 249 | 250 | 251 | \begin{wideverbatim} 252 | : (hex 273) 253 | -> "111" 254 | : (hex "111") 255 | -> 273 256 | : (hex 1234567 4) 257 | -> "12 D687" 258 | \end{wideverbatim} 259 | 260 | 261 | \section*{\texttt{(host 'any) -> sym}} 262 | \label{sec:func-ref-H-(host 'any) -> sym} 263 | 264 | 265 | Returns the hostname corresponding to the given IP address. See also 266 | \texttt{*Adr}. 267 | 268 | 269 | \begin{wideverbatim} 270 | : (host "80.190.158.9") 271 | -> "www.leo.org" 272 | \end{wideverbatim} 273 | 274 | 275 | 276 | 277 | % \input{referenc} 278 | -------------------------------------------------------------------------------- /mainmatter/function-ref-J.tex: -------------------------------------------------------------------------------- 1 | %%%%%%%%%%%%%%%%%%%%% chapter.tex %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2 | % 3 | % sample chapter 4 | % 5 | % Use this file as a template for your own input. 6 | % 7 | %%%%%%%%%%%%%%%%%%%%%%%% Springer-Verlag %%%%%%%%%%%%%%%%%%%%%%%%%% 8 | %\motto{Use the template \emph{chapter.tex} to style the various elements of your chapter content.} 9 | 10 | 11 | 12 | \chapter{Symbols starting with J} 13 | \label{cha:func-ref-J-functions-starting-with-J} 14 | 15 | \section*{\texttt{+Joint}} 16 | \label{sec:func-ref-J-+Joint} 17 | 18 | 19 | Class for bidirectional object relations, a subclass of \texttt{+Link}. Expects 20 | a (symbolic) attribute, and list of classes as \texttt{type} of the referred 21 | database object (of class \texttt{+Entity}). A \texttt{+Joint} corresponds to two 22 | \texttt{+Link}s, where the attribute argument is the relation of the back-link in the referred object. See also \texttt{Database}. 23 | 24 | 25 | \begin{wideverbatim} 26 | (class +Ord +Entity) # Order class 27 | (rel pos (+List +Joint) ord (+Pos)) # List of positions in that order 28 | ... 29 | (class +Pos +Entity) # Position class 30 | (rel ord (+Joint) # Back-link to the parent order 31 | \end{wideverbatim} 32 | 33 | 34 | \section*{\texttt{(job 'lst . prg) -> any}} 35 | \label{sec:func-ref-J-(job 'lst . prg) -> any} 36 | 37 | 38 | Executes a job within its own environment (as specified by symbol-value 39 | pairs in \texttt{lst}). The current values of all symbols are saved, the 40 | symbols are bound to the values in \texttt{lst}, \texttt{prg} is executed, then the 41 | (possibly modified) symbol values are (destructively) stored in the 42 | environment list, and the symbols are restored to their original values. 43 | The return value is the result of \texttt{prg}. Typically used in \texttt{curried} 44 | functions and \texttt{*Run} tasks. See also \texttt{env}, \texttt{bind}, \texttt{let}, \texttt{use} and 45 | \texttt{state}. 46 | 47 | 48 | \begin{wideverbatim} 49 | : (de tst () 50 | (job '((A . 0) (B . 0)) 51 | (println (inc 'A) (inc 'B 2)) ) ) 52 | -> tst 53 | : (tst) 54 | 1 2 55 | -> 2 56 | : (tst) 57 | 2 4 58 | -> 4 59 | : (tst) 60 | 3 6 61 | -> 6 62 | : (pp 'tst) 63 | (de tst NIL 64 | (job '((A . 3) (B . 6)) 65 | (println (inc 'A) (inc 'B 2)) ) ) 66 | -> tst 67 | \end{wideverbatim} 68 | 69 | 70 | \section*{\texttt{(journal 'any ..) -> T}} 71 | \label{sec:func-ref-J-(journal 'any ..) -> T} 72 | 73 | 74 | Reads journal data from the files with the names \texttt{any}, and writes all 75 | changes to the database. See also \texttt{pool}. 76 | 77 | 78 | \begin{wideverbatim} 79 | : (journal "db.log") 80 | -> T 81 | \end{wideverbatim} 82 | 83 | 84 | -------------------------------------------------------------------------------- /mainmatter/function-ref-K.tex: -------------------------------------------------------------------------------- 1 | %%%%%%%%%%%%%%%%%%%%% chapter.tex %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2 | % 3 | % sample chapter 4 | % 5 | % Use this file as a template for your own input. 6 | % 7 | %%%%%%%%%%%%%%%%%%%%%%%% Springer-Verlag %%%%%%%%%%%%%%%%%%%%%%%%%% 8 | %\motto{Use the template \emph{chapter.tex} to style the various elements of your chapter content.} 9 | 10 | 11 | 12 | \chapter{Symbols starting with K} 13 | \label{cha:func-ref-K-functions-starting-with-K} 14 | 15 | \section*{\texttt{+Key}} 16 | \label{sec:func-ref-K-+Key} 17 | 18 | 19 | Prefix class for maintaining unique indexes to \texttt{+relation}s, a 20 | subclass of \texttt{+index}. Accepts an optional argument for a 21 | \texttt{+Hook} attribute. See also \texttt{Database}. 22 | 23 | 24 | \begin{wideverbatim} 25 | (rel nr (+Need +Key +Number)) # Mandatory, unique Customer/Supplier number 26 | \end{wideverbatim} 27 | 28 | 29 | \section*{\texttt{(key ['cnt]) -> sym}} 30 | \label{sec:func-ref-K-(key ['cnt]) -> sym} 31 | 32 | 33 | Returns the next character from standard input as a single-character 34 | transient symbol. The console is set to raw mode. While waiting for a 35 | key press, a \texttt{select} system call is executed for all file descriptors 36 | and timers in the \texttt{VAL} of the global variable \texttt{*Run}. If \texttt{cnt} is 37 | non-\texttt{NIL}, that amount of milliseconds is waited maximally, and \texttt{NIL} is 38 | returned upon timeout. See also \texttt{raw} and \texttt{wait}. 39 | 40 | 41 | \begin{wideverbatim} 42 | : (key) # Wait for a key 43 | -> "a" # 'a' pressed 44 | \end{wideverbatim} 45 | 46 | 47 | \section*{\texttt{(kill 'pid ['cnt]) -> flg}} 48 | \label{sec:func-ref-K-(kill 'pid ['cnt]) -> flg} 49 | 50 | 51 | Sends a signal with the signal number \texttt{cnt} (or SIGTERM if \texttt{cnt} is not 52 | given) to the process with the ID \texttt{pid}. Returns \texttt{T} if successful. 53 | 54 | 55 | \begin{wideverbatim} 56 | : (kill *Pid 20) # Stop current process 57 | 58 | [2]+ Stopped pil + # Unix shell 59 | $ fg # Job control: Foreground 60 | pil + 61 | -> T # 'kill' was successful 62 | \end{wideverbatim} 63 | 64 | 65 | -------------------------------------------------------------------------------- /mainmatter/function-ref-O.tex: -------------------------------------------------------------------------------- 1 | %%%%%%%%%%%%%%%%%%%%% chapter.tex %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2 | % 3 | % sample chapter 4 | % 5 | % Use this file as a template for your own input. 6 | % 7 | %%%%%%%%%%%%%%%%%%%%%%%% Springer-Verlag %%%%%%%%%%%%%%%%%%%%%%%%%% 8 | %\motto{Use the template \emph{chapter.tex} to style the various elements of your chapter content.} 9 | 10 | 11 | \chapter{Symbols starting with O} 12 | \label{cha:func-ref-O-functions-starting-with-O} 13 | 14 | \section*{\texttt{*Once}} 15 | \label{sec:func-ref-O-*Once} 16 | 17 | 18 | Holds an \texttt{idx} tree of already \texttt{load}ed source locations (as returned by \texttt{file}) See also \texttt{once}. 19 | 20 | 21 | \begin{wideverbatim} 22 | : *Once 23 | -> (("lib/" "misc.l" . 11) (("lib/" "http.l" . 9) (("lib/" "form.l" . 11)))) 24 | \end{wideverbatim} 25 | 26 | 27 | \section*{\texttt{*OS}} 28 | \label{sec:func-ref-O-*OS} 29 | 30 | 31 | A global constant holding the name of the operating system. Possible 32 | values include \texttt{''Linux''}, \texttt{''FreeBSD''}, 33 | \texttt{''Darwin''} or \texttt{''Cygwin''}. 34 | 35 | 36 | \begin{wideverbatim} 37 | : *OS 38 | -> "Linux" 39 | \end{wideverbatim} 40 | 41 | 42 | \section*{\texttt{(obj (typ var [hook] val ..) var2 val2 ..) -> obj}} 43 | \label{sec:func-ref-O-(obj (typ var [hook] val ..) var2 val2 ..) -> obj} 44 | 45 | 46 | Finds or creates a database object (using \texttt{request}) corresponding to 47 | \texttt{(typ var [hook] val ..)}, and initializes additional properties using 48 | the \texttt{varN} and \texttt{valN} arguments. 49 | 50 | 51 | \begin{wideverbatim} 52 | : (obj ((+Item) nr 2) nm "Spare Part" sup `(db 'nr '+CuSu 2) inv 100 pr 1250) 53 | -> {3-2} 54 | \end{wideverbatim} 55 | 56 | 57 | \section*{\texttt{(object 'sym 'any ['sym2 'any2 ..]) -> obj}} 58 | \label{sec:func-ref-O-(object 'sym 'any ['sym2 'any2 ..]) -> obj} 59 | 60 | 61 | Defines \texttt{sym} to be an object with the value (or type) \texttt{any}. The 62 | property list is initialized with all optionally supplied key-value 63 | pairs. See also \texttt{OO Concepts}, \texttt{new}, \texttt{type} and \texttt{isa}. 64 | 65 | 66 | \begin{wideverbatim} 67 | : (object 'Obj '(+A +B +C) 'a 1 'b 2 'c 3) 68 | -> Obj 69 | : (show 'Obj) 70 | Obj (+A +B +C) 71 | c 3 72 | b 2 73 | a 1 74 | -> Obj 75 | \end{wideverbatim} 76 | 77 | 78 | \section*{\texttt{(oct 'num ['num]) -> sym}} 79 | \label{sec:func-ref-O-(oct 'num ['num]) -> sym} 80 | 81 | 82 | \texttt{(oct 'sym) -> num} 83 | 84 | Converts a number \texttt{num} to an octal string, or an octal string \texttt{sym} to 85 | a number. In the first case, if the second argument is given, the result 86 | is separated by spaces into groups of such many digits. See also \texttt{bin}, 87 | \texttt{hex}, \texttt{fmt64}, \texttt{hax} and \texttt{format}. 88 | 89 | 90 | \begin{wideverbatim} 91 | : (oct 73) 92 | -> "111" 93 | : (oct "111") 94 | -> 73 95 | : (oct 1234567 3) 96 | -> "4 553 207" 97 | \end{wideverbatim} 98 | 99 | 100 | \section*{\texttt{(off var ..) -> NIL}} 101 | \label{sec:func-ref-O-(off var ..) -> NIL} 102 | 103 | 104 | Stores \texttt{NIL} in all \texttt{var} arguments. See also \texttt{on}, \texttt{onOff}, \texttt{zero} and 105 | \texttt{one}. 106 | 107 | 108 | \begin{wideverbatim} 109 | : (off A B) 110 | -> NIL 111 | : A 112 | -> NIL 113 | : B 114 | -> NIL 115 | \end{wideverbatim} 116 | 117 | 118 | \section*{\texttt{(offset 'lst1 'lst2) -> cnt | NIL}} 119 | \label{sec:func-ref-O-(offset 'lst1 'lst2) -> cnt | NIL} 120 | 121 | 122 | Returns the \texttt{cnt} position of the tail list \texttt{lst1} in \texttt{lst2}, or \texttt{NIL} 123 | if it is not found. See also \texttt{index} and \texttt{tail}. 124 | 125 | 126 | \begin{wideverbatim} 127 | : (offset '(c d e f) '(a b c d e f)) 128 | -> 3 129 | : (offset '(c d e) '(a b c d e f)) 130 | -> NIL 131 | \end{wideverbatim} 132 | 133 | 134 | \section*{\texttt{(on var ..) -> T}} 135 | \label{sec:func-ref-O-(on var ..) -> T} 136 | 137 | 138 | Stores \texttt{T} in all \texttt{var} arguments. See also \texttt{off}, \texttt{onOff}, \texttt{zero} and 139 | \texttt{one}. 140 | 141 | 142 | \begin{wideverbatim} 143 | : (on A B) 144 | -> T 145 | : A 146 | -> T 147 | : B 148 | -> T 149 | \end{wideverbatim} 150 | 151 | 152 | \section*{\texttt{(once . prg) -> any}} 153 | \label{sec:func-ref-O-(once . prg) -> any} 154 | 155 | 156 | Executes \texttt{prg} once, when the current file is \texttt{load}ed the first time. Subsequent loads at a later time will not execute \texttt{prg}, and \texttt{once} 157 | returns \texttt{NIL}. See also \texttt{*Once}. 158 | 159 | 160 | \begin{wideverbatim} 161 | (once 162 | (zero *Cnt1 *Cnt2) # Init counters 163 | (load "file1.l" "file2.l") ) # Load other files 164 | \end{wideverbatim} 165 | 166 | 167 | \section*{\texttt{(one var ..) -> 1}} 168 | \label{sec:func-ref-O-(one var ..) -> 1} 169 | 170 | 171 | Stores \texttt{1} in all \texttt{var} arguments. See also \texttt{zero}, \texttt{on}, \texttt{off} and 172 | \texttt{onOff}. 173 | 174 | 175 | \begin{wideverbatim} 176 | : (one A B) 177 | -> 1 178 | : A 179 | -> 1 180 | : B 181 | -> 1 182 | \end{wideverbatim} 183 | 184 | 185 | \section*{\texttt{(onOff var ..) -> flg}} 186 | \label{sec:func-ref-O-(onOff var ..) -> flg} 187 | 188 | 189 | Logically negates the values of all \texttt{var} arguments. Returns the new 190 | value of the last symbol. See also \texttt{on}, \texttt{off}, \texttt{zero} and \texttt{one}. 191 | 192 | 193 | \begin{wideverbatim} 194 | : (onOff A B) 195 | -> T 196 | : A 197 | -> T 198 | : B 199 | -> T 200 | : (onOff A B) 201 | -> NIL 202 | : A 203 | -> NIL 204 | : B 205 | -> NIL 206 | \end{wideverbatim} 207 | 208 | 209 | \section*{\texttt{(open 'any ['flg]) -> cnt | NIL}} 210 | \label{sec:func-ref-O-(open 'any ['flg]) -> cnt | NIL} 211 | 212 | 213 | Opens the file with the name \texttt{any} in read/write mode (or read-only if 214 | \texttt{flg} is non-\texttt{NIL}), and returns a file descriptor \texttt{cnt} (or \texttt{NIL} on 215 | error). A leading ``\texttt{@}'' character in \texttt{any} is substituted with the 216 | PicoLisp Home Directory, as it was remembered during interpreter 217 | startup. If \texttt{flg} is \texttt{NIL} and the file does not exist, it is created. 218 | The file descriptor can be used in subsequent calls to \texttt{in} and \texttt{out}. 219 | See also \texttt{close} and \texttt{poll}. 220 | 221 | 222 | \begin{wideverbatim} 223 | : (open "x") 224 | -> 3 225 | \end{wideverbatim} 226 | 227 | 228 | \section*{\texttt{(opid) -> pid | NIL}} 229 | \label{sec:func-ref-O-(opid) -> pid | NIL} 230 | 231 | 232 | Returns the corresponding process ID when the current output channel is 233 | writing to a pipe, otherwise \texttt{NIL}. See also \texttt{ipid} and \texttt{out}. 234 | 235 | 236 | \begin{wideverbatim} 237 | : (out '(cat) (call 'ps "-p" (opid))) 238 | PID TTY TIME CMD 239 | 7127 pts/3 00:00:00 cat 240 | -> T 241 | \end{wideverbatim} 242 | 243 | 244 | \section*{\texttt{(opt) -> sym}} 245 | \label{sec:func-ref-O-(opt) -> sym} 246 | 247 | 248 | Return the next command line argument (``option'', as would be processed 249 | by \texttt{load}) as a string, and remove it from the remaining command line 250 | arguments. See also \emph{Invocation} and \texttt{argv}. 251 | 252 | 253 | \begin{wideverbatim} 254 | $ pil -"de f () (println 'opt (opt))" -f abc -bye 255 | opt "abc" 256 | \end{wideverbatim} 257 | 258 | 259 | \section*{\texttt{(or 'any ..) -> any}} 260 | \label{sec:func-ref-O-(or 'any ..) -> any} 261 | 262 | 263 | Logical OR. The expressions \texttt{any} are evaluated from left to right. If a 264 | non-\texttt{NIL} value is encountered, it is returned immediately. Else the 265 | result of the last expression is returned. 266 | 267 | 268 | \begin{wideverbatim} 269 | : (or (= 3 3) (read)) 270 | -> T 271 | : (or (= 3 4) (read)) 272 | abc 273 | -> abc 274 | \end{wideverbatim} 275 | 276 | 277 | \section*{\texttt{or/2}} 278 | \label{sec:func-ref-O-or/2} 279 | 280 | 281 | \emph{Pilog} predicate that takes an arbitrary number of 282 | clauses, and succeeds if one of them can be proven. See also \texttt{not/1}. 283 | 284 | 285 | \begin{wideverbatim} 286 | : (? 287 | (or 288 | ((equal 3 @X) (equal @X 4)) 289 | ((equal 7 @X) (equal @X 7)) ) ) 290 | @X=7 291 | -> NIL 292 | \end{wideverbatim} 293 | 294 | 295 | \section*{\texttt{(out 'any . prg) -> any}} 296 | \label{sec:func-ref-O-(out 'any . prg) -> any} 297 | 298 | 299 | Opens \texttt{any} as output channel during the execution of 300 | \texttt{prg}. The current output channel will be saved and restored 301 | appropriately. If the argument is \texttt{NIL}, standard output is 302 | used. If the argument is a symbol, it is used as a file name (opened 303 | in ``append'' mode if the first character is ``\texttt{+}''). If it is 304 | a positve number, it is used as the descriptor of an open file. If it 305 | is a negative number, the saved output channel such many levels above 306 | the current one is used. Otherwise (if it is a list), it is taken as a 307 | command with arguments, and a pipe is opened for output. See also 308 | \texttt{opid}, \texttt{ call}, \texttt{in}, \texttt{err}, 309 | \texttt{ctl}, \texttt{pipe}, \texttt{ poll}, \texttt{close} and 310 | \texttt{load}. 311 | 312 | 313 | \begin{wideverbatim} 314 | : (out "a" (println 123 '(a b c) 'def)) # Write one line to file "a" 315 | -> def 316 | \end{wideverbatim} 317 | 318 | 319 | 320 | 321 | % \input{referenc} 322 | -------------------------------------------------------------------------------- /mainmatter/function-ref-Q.tex: -------------------------------------------------------------------------------- 1 | %%%%%%%%%%%%%%%%%%%%% chapter.tex %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2 | % 3 | % sample chapter 4 | % 5 | % Use this file as a template for your own input. 6 | % 7 | %%%%%%%%%%%%%%%%%%%%%%%% Springer-Verlag %%%%%%%%%%%%%%%%%%%%%%%%%% 8 | %\motto{Use the template \emph{chapter.tex} to style the various elements of your chapter content.} 9 | 10 | 11 | 12 | \chapter{Symbols starting with Q} 13 | \label{cha:func-ref-Q-functions-starting-with-Q} 14 | 15 | \section*{\texttt{(qsym . sym) -> lst}} 16 | \label{sec:func-ref-Q-(qsym . sym) -> lst} 17 | 18 | 19 | Returns a cons pair of the value and property list of \texttt{sym}. See also 20 | \texttt{quote}, \texttt{val} and \texttt{getl}. 21 | 22 | 23 | \begin{wideverbatim} 24 | : (setq A 1234) 25 | -> 1234 26 | : (put 'A 'a 1) 27 | -> 1 28 | : (put 'A 'b 2) 29 | -> 2 30 | : (put 'A 'f T) 31 | -> T 32 | : (qsym . A) 33 | -> (1234 f (2 . b) (1 . a)) 34 | \end{wideverbatim} 35 | 36 | 37 | \section*{\texttt{(quote . any) -> any}} 38 | \label{sec:func-ref-Q-(quote . any) -> any} 39 | 40 | 41 | Returns \texttt{any} unevaluated. The reader recognizes the single quote char 42 | \texttt{'} as a macro for this function. See also \texttt{lit}. 43 | 44 | 45 | \begin{wideverbatim} 46 | : 'a 47 | -> a 48 | : '(foo a b c) 49 | -> (foo a b c) 50 | : (quote (quote (quote a))) 51 | -> ('('(a))) 52 | \end{wideverbatim} 53 | 54 | 55 | \section*{\texttt{(query 'lst ['lst]) -> flg}} 56 | \label{sec:func-ref-Q-(query 'lst ['lst]) -> flg} 57 | 58 | 59 | Handles an interactive \emph{Pilog} query. The two \texttt{lst} 60 | arguments are passed to \texttt{prove}. \texttt{query} displays each result, waits for 61 | console input, and terminates when a non-empty line is entered. See also 62 | \texttt{?}, \texttt{pilog} and \texttt{solve}. 63 | 64 | 65 | \begin{wideverbatim} 66 | : (query (goal '((append @X @Y (a b c))))) 67 | @X=NIL @Y=(a b c) 68 | @X=(a) @Y=(b c). # Stop 69 | -> NIL 70 | \end{wideverbatim} 71 | 72 | 73 | \section*{\texttt{(queue 'var 'any) -> any}} 74 | \label{sec:func-ref-Q-(queue 'var 'any) -> any} 75 | 76 | 77 | Implements a queue using a list in \texttt{var}. The \texttt{any} argument is 78 | (destructively) concatenated to the end of the value list. See also 79 | \texttt{push}, \texttt{pop} and \texttt{fifo}. 80 | 81 | 82 | \begin{wideverbatim} 83 | : (queue 'A 1) 84 | -> 1 85 | : (queue 'A 2) 86 | -> 2 87 | : (queue 'A 3) 88 | -> 3 89 | : A 90 | -> (1 2 3) 91 | : (pop 'A) 92 | -> 1 93 | : A 94 | -> (2 3) 95 | \end{wideverbatim} 96 | 97 | 98 | \section*{\texttt{(quit ['any ['any]])}} 99 | \label{sec:func-ref-Q-(quit ['any ['any]])} 100 | 101 | 102 | Stops current execution. If no arguments are given, all pending 103 | \texttt{finally} expressions are executed and control is returned to the top 104 | level read-eval-print loop. Otherwise, an error handler is entered. The 105 | first argument can be some error message, and the second might be the 106 | reason for the error. See also \texttt{Error Handling}. 107 | 108 | 109 | \begin{wideverbatim} 110 | : (de foo (X) (quit "Sorry, my error" X)) 111 | -> foo 112 | : (foo 123) # 'X' is bound to '123' 113 | 123 -- Sorry, my error # Error entered 114 | ? X # Inspect 'X' 115 | -> 123 116 | ? # Empty line: Exit 117 | : 118 | \end{wideverbatim} 119 | 120 | 121 | -------------------------------------------------------------------------------- /mainmatter/function-ref-U.tex: -------------------------------------------------------------------------------- 1 | %%%%%%%%%%%%%%%%%%%%% chapter.tex %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2 | % 3 | % sample chapter 4 | % 5 | % Use this file as a template for your own input. 6 | % 7 | %%%%%%%%%%%%%%%%%%%%%%%% Springer-Verlag %%%%%%%%%%%%%%%%%%%%%%%%%% 8 | %\motto{Use the template \emph{chapter.tex} to style the various elements of your chapter content.} 9 | 10 | 11 | \chapter{Symbols starting with U} 12 | \label{cha:func-ref-U-functions-starting-with-U} 13 | 14 | \section*{\texttt{*Uni}} 15 | \label{sec:func-ref-U-*Uni} 16 | 17 | 18 | A global variable holding an \texttt{idx} tree, with all unique data that were 19 | collected with the comma (\texttt{,}) read-macro. Typically used for 20 | localization. See also \texttt{Read-Macros} and \texttt{locale}. 21 | 22 | 23 | \begin{wideverbatim} 24 | : (off *Uni) # Clear 25 | -> NIL 26 | : ,"abc" # Collect a transient symbol 27 | -> "abc" 28 | : ,(1 2 3) # Collect a list 29 | -> (1 2 3) 30 | : *Uni 31 | -> ("abc" NIL (1 2 3)) 32 | \end{wideverbatim} 33 | 34 | 35 | \section*{\texttt{+UB}} 36 | \label{sec:func-ref-U-+UB} 37 | 38 | 39 | Prefix class for \texttt{+Aux} to maintain an UB-Tree index instead of the 40 | direct values. This allows efficient range access to multidimensional 41 | data. Only numeric keys are supported. See also \texttt{Database}. 42 | 43 | 44 | \begin{wideverbatim} 45 | (class +Pos +Entity) 46 | (rel x (+UB +Aux +Ref +Number) (y z)) 47 | (rel y (+Number)) 48 | (rel z (+Number)) 49 | 50 | : (scan (tree 'x '+Pos)) 51 | ... 52 | (664594005183881683 . {B}) {B} 53 | (899018453307525604 . {C}) {C} # UBKEY of (516516 690628 706223) 54 | (943014863198293414 . {2}) {2} 55 | (988682500781514058 . {A}) {A} 56 | (994667870851824704 . {8}) {8} 57 | (1016631364991047263 . {:}) {:} 58 | ... 59 | 60 | : (show '{C}) 61 | {C} (+Pos) 62 | z 706223 63 | y 690628 64 | x 516516 65 | -> {C} 66 | 67 | # Discrete queries work the same way as without the +UB prefix 68 | : (db 'x '+Pos 516516 'y 690628 'z 706223) 69 | -> {C} 70 | : (aux 'x '+Pos 516516 690628 706223) 71 | -> {C} 72 | : (? (db x +Pos (516516 690628 706223) @Pos)) 73 | @Pos={C} 74 | -> NIL 75 | 76 | # Efficient range queries are are possible now 77 | : (? 78 | @X (416511 . 616519) 79 | @Y (590621 . 890629) 80 | @Z (606221 . 906229) 81 | (select (@@) 82 | ((x +Pos (@X @Y @Z))) # Range query 83 | (range @X @@ x) # Filter 84 | (range @Y @@ y) 85 | (range @Z @@ z) ) ) 86 | @X=(416511 . 616519) @Y=(590621 . 890629) @Z=(606221 . 906229) @@={C} 87 | @X=(416511 . 616519) @Y=(590621 . 890629) @Z=(606221 . 906229) @@={8} 88 | \end{wideverbatim} 89 | 90 | 91 | \section*{\texttt{(u) -> T}} 92 | \label{sec:func-ref-U-(u) -> T} 93 | 94 | 95 | Removes \texttt{!} all breakpoints in all subexpressions of the current 96 | breakpoint. Typically used when single-stepping a function or method 97 | with \texttt{debug}. See also \texttt{d} and \texttt{unbug}. 98 | 99 | 100 | \begin{wideverbatim} 101 | ! (u) # Unbug subexpression(s) at breakpoint 102 | -> T 103 | \end{wideverbatim} 104 | 105 | 106 | \section*{\texttt{(udp 'any1 'any2 'any3) -> any}} 107 | \label{sec:func-ref-U-(udp 'any1 'any2 'any3) -> any} 108 | 109 | 110 | \texttt{(udp 'cnt) -> any} 111 | 112 | Simple unidirectional sending/receiving of UDP packets. In the first 113 | form, \texttt{any3} is sent to a UDP server listening at host \texttt{any1}, port 114 | \texttt{any2}. In the second form, one item is received from a UDP socket 115 | \texttt{cnt}, established with \texttt{port}. See also \texttt{listen} and \texttt{connect}. 116 | 117 | 118 | \begin{wideverbatim} 119 | # First session 120 | : (port T 6666) 121 | -> 3 122 | : (udp 3) # Receive a datagram 123 | 124 | # Second session (on the same machine) 125 | : (udp "localhost" 6666 '(a b c)) 126 | -> (a b c) 127 | 128 | # First session 129 | -> (a b c) 130 | \end{wideverbatim} 131 | 132 | 133 | \section*{\texttt{(ultimo 'y 'm) -> cnt}} 134 | \label{sec:func-ref-U-(ultimo 'y 'm) -> cnt} 135 | 136 | 137 | Returns the \texttt{date} of the last day of the month \texttt{m} in the year \texttt{y}. See 138 | also \texttt{day} and \texttt{week}. 139 | 140 | 141 | \begin{wideverbatim} 142 | : (date (ultimo 2007 1)) 143 | -> (2007 1 31) 144 | : (date (ultimo 2007 2)) 145 | -> (2007 2 28) 146 | : (date (ultimo 2004 2)) 147 | -> (2004 2 29) 148 | : (date (ultimo 2000 2)) 149 | -> (2000 2 29) 150 | : (date (ultimo 1900 2)) 151 | -> (1900 2 28) 152 | \end{wideverbatim} 153 | 154 | 155 | \section*{\texttt{(unbug 'sym) -> T}} 156 | \label{sec:func-ref-U-(unbug 'sym) -> T} 157 | 158 | 159 | \texttt{(unbug 'sym 'cls) -> T} 160 | 161 | \texttt{(unbug '(sym . cls)) -> T} 162 | 163 | Removes all \texttt{!} breakpoints in the function or method body of sym, as 164 | inserted with \texttt{debug} or \texttt{d}, or directly with \texttt{edit}. See also \texttt{u}. 165 | 166 | 167 | \begin{wideverbatim} 168 | : (pp 'tst) 169 | (de tst (N) 170 | (! println (+ 3 N)) ) # 'tst' has a breakpoint '!' 171 | -> tst 172 | : (unbug 'tst) # Unbug it 173 | -> T 174 | : (pp 'tst) # Restore 175 | (de tst (N) 176 | (println (+ 3 N)) ) 177 | \end{wideverbatim} 178 | 179 | 180 | \section*{\texttt{(undef 'sym) -> fun}} 181 | \label{sec:func-ref-U-(undef 'sym) -> fun} 182 | 183 | 184 | \texttt{(undef 'sym 'cls) -> fun} 185 | 186 | \texttt{(undef '(sym . cls)) -> fun} 187 | 188 | Undefines the function or method \texttt{sym}. Returns the previous definition. 189 | See also \texttt{de}, \texttt{dm}, \texttt{def} and \texttt{redef}. 190 | 191 | 192 | \begin{wideverbatim} 193 | : (de hello () "Hello world!") 194 | -> hello 195 | : hello 196 | -> (NIL "Hello world!") 197 | : (undef 'hello) 198 | -> (NIL "Hello world!") 199 | : hello 200 | -> NIL 201 | \end{wideverbatim} 202 | 203 | 204 | \section*{\texttt{(unify 'any) -> lst}} 205 | \label{sec:func-ref-U-(unify 'any) -> lst} 206 | 207 | 208 | Unifies \texttt{any} with the current \emph{Pilog} environment at 209 | the current level and with a value of \texttt{NIL}, and returns the new 210 | environment or \texttt{NIL} if not successful. See also \texttt{prove} and \texttt{->}. 211 | 212 | 213 | \begin{wideverbatim} 214 | : (? (@A unify '(@B @C))) 215 | @A=(((NIL . @C) 0 . @C) ((NIL . @B) 0 . @B) T) 216 | \end{wideverbatim} 217 | 218 | 219 | \section*{\texttt{(uniq 'lst) -> lst}} 220 | \label{sec:func-ref-U-(uniq 'lst) -> lst} 221 | 222 | 223 | Returns a unique list, by eleminating all duplicate elements from \texttt{lst}. 224 | See also \emph{Comparing}, \texttt{sort} and \texttt{group}. 225 | 226 | 227 | \begin{wideverbatim} 228 | : (uniq (2 4 6 1 2 3 4 5 6 1 3 5)) 229 | -> (2 4 6 1 3 5) 230 | \end{wideverbatim} 231 | 232 | 233 | \section*{\texttt{uniq/2}} 234 | \label{sec:func-ref-U-uniq/2} 235 | 236 | 237 | \emph{Pilog} predicate that succeeds if the first argument 238 | is not yet stored in the second argument's index structure. \texttt{idx} is 239 | used internally storing for the values and checking for uniqueness. See 240 | also \texttt{member/2}. 241 | 242 | 243 | \begin{wideverbatim} 244 | : (? (uniq a @Z)) # Remember 'a' 245 | @Z=NIL # Succeeded 246 | 247 | : (? (uniq b @Z)) # Remember 'b' 248 | @Z=NIL # Succeeded 249 | 250 | : (? (uniq a @Z)) # Remembered 'a'? 251 | -> NIL # Yes: Not unique 252 | \end{wideverbatim} 253 | 254 | 255 | \section*{\texttt{(unless 'any . prg) -> any}} 256 | \label{sec:func-ref-U-(unless 'any . prg) -> any} 257 | 258 | 259 | Conditional execution: When the condition \texttt{any} evaluates to non-\texttt{NIL}, 260 | \texttt{NIL} is returned. Otherwise \texttt{prg} is executed and the result returned. 261 | See also \texttt{when}. 262 | 263 | 264 | \begin{wideverbatim} 265 | : (unless (= 3 3) (println 'Strange 'result)) 266 | -> NIL 267 | : (unless (= 3 4) (println 'Strange 'result)) 268 | Strange result 269 | -> result 270 | \end{wideverbatim} 271 | 272 | 273 | \section*{\texttt{(until 'any . prg) -> any}} 274 | \label{sec:func-ref-U-(until 'any . prg) -> any} 275 | 276 | 277 | Conditional loop: While the condition \texttt{any} evaluates to \texttt{NIL}, \texttt{prg} is 278 | repeatedly executed. If \texttt{prg} is never executed, \texttt{NIL} is returned. 279 | Otherwise the result of \texttt{prg} is returned. See also \texttt{while}. 280 | 281 | 282 | \begin{wideverbatim} 283 | : (until (=T (setq N (read))) 284 | (println 'square (* N N)) ) 285 | 4 286 | square 16 287 | 9 288 | square 81 289 | T 290 | -> 81 291 | \end{wideverbatim} 292 | 293 | 294 | \section*{\texttt{(untrace 'sym) -> sym}} 295 | \label{sec:func-ref-U-(untrace 'sym) -> sym} 296 | 297 | 298 | \texttt{(untrace 'sym 'cls) -> sym} 299 | 300 | \texttt{(untrace '(sym . cls)) -> sym} 301 | 302 | Removes the \texttt{\$} trace function call at the beginning of the function or 303 | method body of \texttt{sym}, so that no more trace information will be printed 304 | before and after execution. Built-in functions (C-function pointer) are 305 | automatically converted to their original form (see \texttt{subr}). See also 306 | \texttt{trace} and \texttt{traceAll}. 307 | 308 | 309 | \begin{wideverbatim} 310 | : (trace '+) # Trace the '+' function 311 | -> + 312 | : + 313 | -> (@ ($ + @ (pass $385455126))) # Modified for tracing 314 | : (untrace '+) # Untrace '+' 315 | -> + 316 | : + 317 | -> 67319120 # Back to original form 318 | \end{wideverbatim} 319 | 320 | 321 | \section*{\texttt{(up [cnt] sym ['val]) -> any}} 322 | \label{sec:func-ref-U-(up [cnt] sym ['val]) -> any} 323 | 324 | 325 | Looks up (or modifies) the \texttt{cnt}'th previously saved value of \texttt{sym} in 326 | the corresponding enclosing environment. If \texttt{cnt} is not given, 1 is 327 | used. See also \texttt{eval}, \texttt{run} and \texttt{env}. 328 | 329 | 330 | \begin{wideverbatim} 331 | : (let N 1 ((quote (N) (println N (up N))) 2)) 332 | 2 1 333 | -> 1 334 | : (let N 1 ((quote (N) (println N (up N) (up N 7))) 2) N) 335 | 2 1 7 336 | -> 7 337 | \end{wideverbatim} 338 | 339 | 340 | \section*{\texttt{(upd sym ..) -> lst}} 341 | \label{sec:func-ref-U-(upd sym ..) -> lst} 342 | 343 | 344 | Synchronizes the internal state of all passed (external) symbols by 345 | passing them to \texttt{wipe}. \texttt{upd} is the standard function passed to 346 | \texttt{commit} during database \texttt{transactions}. 347 | 348 | 349 | \begin{wideverbatim} 350 | (commit 'upd) # Commit changes, informing all sister processes 351 | \end{wideverbatim} 352 | 353 | 354 | \section*{\texttt{(update 'obj ['var]) -> obj}} 355 | \label{sec:func-ref-U-(update 'obj ['var]) -> obj} 356 | 357 | 358 | Interactive database function for modifying external symbols. When 359 | called only with an \texttt{obj} argument, \texttt{update} steps through the value and 360 | all properties of that object (and recursively also through 361 | substructures) and allows to edit them with the console line editor. 362 | When the \texttt{var} argument is given, only that single property is handed to 363 | the editor. To delete a propery, \texttt{NIL} must be explicitly entered. 364 | \texttt{update} will correctly handle all \emph{entity/relation} 365 | mechanisms. See also \texttt{select}, \texttt{edit} and \texttt{Database}. 366 | 367 | 368 | \begin{wideverbatim} 369 | : (show '{3-1}) # Show item 1 370 | {3-1} (+Item) 371 | nr 1 372 | pr 29900 373 | inv 100 374 | sup {2-1} 375 | nm "Main Part" 376 | -> {3-1} 377 | 378 | : (update '{3-1} 'pr) # Update the prices of that item 379 | {3-1} pr 299.00 # The cursor is right behind "299.00" 380 | -> {3-1} 381 | \end{wideverbatim} 382 | 383 | 384 | \section*{\texttt{(upp? 'any) -> sym | NIL}} 385 | \label{sec:func-ref-U-(upp? 'any) -> sym | NIL} 386 | 387 | 388 | Returns \texttt{any} when the argument is a string (symbol) that starts with an 389 | uppercase character. See also \texttt{uppc} and \texttt{low?} 390 | 391 | 392 | \begin{wideverbatim} 393 | : (upp? "A") 394 | -> T 395 | : (upp? "a") 396 | -> NIL 397 | : (upp? 123) 398 | -> NIL 399 | : (upp? ".") 400 | -> NIL 401 | \end{wideverbatim} 402 | 403 | 404 | \section*{\texttt{(uppc 'any) -> any}} 405 | \label{sec:func-ref-U-(uppc 'any) -> any} 406 | 407 | 408 | Upper case conversion: If \texttt{any} is not a symbol, it is returned as it 409 | is. Otherwise, a new transient symbol with all characters of \texttt{any}, 410 | converted to upper case, is returned. See also \texttt{lowc}, \texttt{fold} and 411 | \texttt{upp?}. 412 | 413 | 414 | \begin{wideverbatim} 415 | : (uppc 123) 416 | -> 123 417 | : (uppc "abc") 418 | -> "ABC" 419 | : (uppc 'car) 420 | -> "CAR" 421 | \end{wideverbatim} 422 | 423 | 424 | \section*{\texttt{(use sym . prg) -> any}} 425 | \label{sec:func-ref-U-(use sym . prg) -> any} 426 | 427 | 428 | \texttt{(use (sym ..) . prg) -> any} 429 | 430 | Defines local variables. The value of the symbol \texttt{sym} - or the values 431 | of the symbols \texttt{sym} in the list of the second form - are saved, \texttt{prg} 432 | is executed, then the symbols are restored to their original values. 433 | During execution of \texttt{prg}, the values of the symbols can be temporarily 434 | modified. The return value is the result of \texttt{prg}. See also \texttt{bind}, 435 | \texttt{job} and \texttt{let}. 436 | 437 | 438 | \begin{wideverbatim} 439 | : (setq X 123 Y 456) 440 | -> 456 441 | : (use (X Y) (setq X 3 Y 4) (* X Y)) 442 | -> 12 443 | : X 444 | -> 123 445 | : Y 446 | -> 456 447 | \end{wideverbatim} 448 | 449 | 450 | \section*{\texttt{(useKey 'var 'cls ['hook]) -> num}} 451 | \label{sec:func-ref-U-(useKey 'var 'cls ['hook]) -> num} 452 | 453 | 454 | Generates or reuses a key for a database tree, by randomly trying to 455 | locate a free number. See also \texttt{genKey}. 456 | 457 | 458 | \begin{wideverbatim} 459 | : (maxKey (tree 'nr '+Item)) 460 | -> 8 461 | : (useKey 'nr '+Item) 462 | -> 12 463 | \end{wideverbatim} 464 | 465 | 466 | \section*{\texttt{(usec) -> num}} 467 | \label{sec:func-ref-U-(usec) -> num} 468 | 469 | 470 | Returns the number the microseconds since interpreter startup. See also 471 | \texttt{time} and \texttt{tick}. 472 | 473 | 474 | \begin{wideverbatim} 475 | : (usec) 476 | -> 1154702479219050 477 | \end{wideverbatim} 478 | 479 | -------------------------------------------------------------------------------- /mainmatter/function-ref-V.tex: -------------------------------------------------------------------------------- 1 | %%%%%%%%%%%%%%%%%%%%% chapter.tex %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2 | % 3 | % sample chapter 4 | % 5 | % Use this file as a template for your own input. 6 | % 7 | %%%%%%%%%%%%%%%%%%%%%%%% Springer-Verlag %%%%%%%%%%%%%%%%%%%%%%%%%% 8 | %\motto{Use the template \emph{chapter.tex} to style the various elements of your chapter content.} 9 | 10 | \chapter{Symbols starting with V} 11 | \label{cha:func-ref-V-functions-starting-with-V} 12 | 13 | \section*{\texttt{(val 'var) -> any}} 14 | \label{sec:func-ref-V-(val 'var) -> any} 15 | 16 | 17 | Returns the current value of \texttt{var}. See also \texttt{setq}, \texttt{set} and \texttt{def}. 18 | 19 | 20 | \begin{wideverbatim} 21 | : (setq L '(a b c)) 22 | -> (a b c) 23 | : (val 'L) 24 | -> (a b c) 25 | : (val (cdr L)) 26 | -> b 27 | \end{wideverbatim} 28 | 29 | 30 | \section*{\texttt{val/3}} 31 | \label{sec:func-ref-V-val/3} 32 | 33 | 34 | \emph{Pilog} predicate that returns the value of an 35 | object's attribute. Typically used in database queries. The first 36 | argument is a Pilog variable to bind the value, the second is the 37 | object, and the third and following arguments are used to apply the 38 | \texttt{get} algorithm to that object. See also \texttt{db/3} and \texttt{select/3}. 39 | 40 | 41 | \begin{wideverbatim} 42 | : (? 43 | (db nr +Item (2 . 5) @Item) # Fetch articles 2 through 5 44 | (val @Nm @Item nm) # Get item description 45 | (val @Sup @Item sup nm) ) # and supplier's name 46 | @Item={3-2} @Nm="Spare Part" @Sup="Seven Oaks Ltd." 47 | @Item={3-3} @Nm="Auxiliary Construction" @Sup="Active Parts Inc." 48 | @Item={3-4} @Nm="Enhancement Additive" @Sup="Seven Oaks Ltd." 49 | @Item={3-5} @Nm="Metal Fittings" @Sup="Active Parts Inc." 50 | -> NIL 51 | \end{wideverbatim} 52 | 53 | 54 | \section*{\texttt{(var sym . any) -> any}} 55 | \label{sec:func-ref-V-(var sym . any) -> any} 56 | 57 | 58 | \texttt{(var (sym . cls) . any) -> any} 59 | 60 | Defines a class variable \texttt{sym} with the initial value \texttt{any} for the 61 | current class, implicitly given by the value of the global variable 62 | \texttt{*Class}, or - in the second form - for the explicitly given class cls. 63 | See also \emph{OO Concepts}, \texttt{rel} and \texttt{var:}. 64 | 65 | 66 | \begin{wideverbatim} 67 | : (class +A) 68 | -> +A 69 | : (var a . 1) 70 | -> 1 71 | : (var b . 2) 72 | -> 2 73 | : (show '+A) 74 | +A NIL 75 | b 2 76 | a 1 77 | -> +A 78 | \end{wideverbatim} 79 | 80 | 81 | \section*{\texttt{(var: sym) -> any}} 82 | \label{sec:func-ref-V-(var: sym) -> any} 83 | 84 | 85 | Fetches the value of a class variable \texttt{sym} for the current 86 | object \texttt{This}, by searching the property lists of its class(es) 87 | and supperclasses. See also \texttt{OO Concepts}, \texttt{var}, 88 | \texttt{with}, \texttt{meta}, \texttt{:}, \texttt{=:} and \texttt{::}. 89 | 90 | 91 | \begin{wideverbatim} 92 | : (object 'O '(+A) 'a 9 'b 8) 93 | -> O 94 | : (with 'O (list (: a) (: b) (var: a) (var: b))) 95 | -> (9 8 1 2) 96 | \end{wideverbatim} 97 | 98 | 99 | \section*{\texttt{(version ['flg]) -> lst}} 100 | \label{sec:func-ref-V-(version ['flg]) -> lst} 101 | 102 | 103 | Prints the current version as a string of dot-separated numbers, and 104 | returns the current version as a list of numbers. The JVM- and 105 | C-versions print an additional ``JVM'' or ``C'', respectively, separated by 106 | a space. When \texttt{flg} is non-NIL, printing is suppressed. 107 | 108 | 109 | \begin{wideverbatim} 110 | $ pil -version 111 | 3.0.1.22 112 | : (version T) 113 | -> (3 0 1 22) 114 | \end{wideverbatim} 115 | 116 | 117 | \section*{\texttt{(vi 'sym) -> sym}} 118 | \label{sec:func-ref-V-(vi 'sym) -> sym} 119 | 120 | 121 | \texttt{(vi 'sym 'cls) -> sym} 122 | 123 | \texttt{(vi '(sym . cls)) -> sym} 124 | 125 | \texttt{(vi) -> NIL} 126 | 127 | Opens the ``vi'' editor on the function or method definition of \texttt{sym}. A 128 | call to \texttt{ld} thereafter will \texttt{load} the modified file. See also \texttt{doc}, 129 | \texttt{edit}, \texttt{*Dbg}, \texttt{debug} and \texttt{pp}. 130 | 131 | 132 | \begin{wideverbatim} 133 | : (vi 'url> '+CuSu) # Edit the method's source code, then exit from 'vi' 134 | -> T 135 | \end{wideverbatim} 136 | 137 | 138 | \section*{\texttt{(view 'lst ['T]) -> any}} 139 | \label{sec:func-ref-V-(view 'lst ['T]) -> any} 140 | 141 | 142 | Views \texttt{lst} as tree-structured ASCII graphics. When the \texttt{T} argument is 143 | given, \texttt{lst} should be a binary tree structure (as generated by \texttt{idx}), 144 | which is then shown as a left-rotated tree. See also \texttt{pretty} and 145 | \texttt{show}. 146 | 147 | 148 | \begin{wideverbatim} 149 | : (balance 'I '(a b c d e f g h i j k l m n o)) 150 | -> NIL 151 | : I 152 | -> (h (d (b (a) c) f (e) g) l (j (i) k) n (m) o) 153 | 154 | : (view I) 155 | +-- h 156 | | 157 | +---+-- d 158 | | | 159 | | +---+-- b 160 | | | | 161 | | | +---+-- a 162 | | | | 163 | | | +-- c 164 | | | 165 | | +-- f 166 | | | 167 | | +---+-- e 168 | | | 169 | | +-- g 170 | | 171 | +-- l 172 | | 173 | +---+-- j 174 | | | 175 | | +---+-- i 176 | | | 177 | | +-- k 178 | | 179 | +-- n 180 | | 181 | +---+-- m 182 | | 183 | +-- o 184 | -> NIL 185 | 186 | : (view I T) 187 | o 188 | n 189 | m 190 | l 191 | k 192 | j 193 | i 194 | h 195 | g 196 | f 197 | e 198 | d 199 | c 200 | b 201 | a 202 | -> NIL 203 | \end{wideverbatim} 204 | 205 | -------------------------------------------------------------------------------- /mainmatter/function-ref-W.tex: -------------------------------------------------------------------------------- 1 | %%%%%%%%%%%%%%%%%%%%% chapter.tex %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2 | % 3 | % sample chapter 4 | % 5 | % Use this file as a template for your own input. 6 | % 7 | %%%%%%%%%%%%%%%%%%%%%%%% Springer-Verlag %%%%%%%%%%%%%%%%%%%%%%%%%% 8 | %\motto{Use the template \emph{chapter.tex} to style the various elements of your chapter content.} 9 | 10 | 11 | 12 | \chapter{Symbols starting with W} 13 | \label{cha:func-ref-W-functions-starting-with-W} 14 | 15 | 16 | \section*{\texttt{(wait ['cnt] . prg) -> any}} 17 | \label{sec:func-ref-W-(wait ['cnt] . prg) -> any} 18 | 19 | 20 | Waits for a condition. While the result of the execution of \texttt{prg} is 21 | \texttt{NIL}, a \texttt{select} system call is executed for all file descriptors and 22 | timers in the \texttt{VAL} of the global variable \texttt{*Run}. When \texttt{cnt} is 23 | non-\texttt{NIL}, the waiting time is limited to \texttt{cnt} milliseconds. Returns 24 | the result of \texttt{prg}. See also \texttt{key} and \texttt{sync}. 25 | 26 | 27 | \begin{wideverbatim} 28 | : (wait 2000) # Wait 2 seconds 29 | -> NIL 30 | : (prog 31 | (zero *Cnt) 32 | (setq *Run # Install background loop 33 | '((-2000 0 (println (inc '*Cnt)))) ) # Increment '*Cnt' every 2 sec 34 | (wait NIL (> *Cnt 6)) # Wait until > 6 35 | (off *Run) ) 36 | 1 # Waiting .. 37 | 2 38 | 3 39 | 4 40 | 5 41 | 6 42 | 7 43 | -> NIL 44 | \end{wideverbatim} 45 | 46 | 47 | \section*{\texttt{(week 'dat) -> num}} 48 | \label{sec:func-ref-W-(week 'dat) -> num} 49 | 50 | 51 | Returns the number of the week for a given \texttt{date} \texttt{dat}. See also \texttt{day}, 52 | \texttt{ultimo}, \texttt{datStr} and \texttt{strDat}. 53 | 54 | 55 | \begin{wideverbatim} 56 | : (datStr (date)) 57 | -> "2007-06-01" 58 | : (week (date)) 59 | -> 22 60 | \end{wideverbatim} 61 | 62 | 63 | \section*{\texttt{(when 'any . prg) -> any}} 64 | \label{sec:func-ref-W-(when 'any . prg) -> any} 65 | 66 | 67 | Conditional execution: When the condition \texttt{any} evaluates to non-\texttt{NIL}, 68 | \texttt{prg} is executed and the result is returned. Otherwise \texttt{NIL} is 69 | returned. See also \texttt{unless}. 70 | 71 | 72 | \begin{wideverbatim} 73 | : (when (> 4 3) (println 'OK) (println 'Good)) 74 | OK 75 | Good 76 | -> Good 77 | \end{wideverbatim} 78 | 79 | 80 | \section*{\texttt{(while 'any . prg) -> any}} 81 | \label{sec:func-ref-W-(while 'any . prg) -> any} 82 | 83 | 84 | Conditional loop: While the condition \texttt{any} evaluates to non-\texttt{NIL}, 85 | \texttt{prg} is repeatedly executed. If \texttt{prg} is never executed, \texttt{NIL} is 86 | returned. Otherwise the result of \texttt{prg} is returned. See also \texttt{until}. 87 | 88 | 89 | \begin{wideverbatim} 90 | : (while (read) 91 | (println 'got: @) ) 92 | abc 93 | got: abc 94 | 1234 95 | got: 1234 96 | NIL 97 | -> 1234 98 | \end{wideverbatim} 99 | 100 | 101 | \section*{\texttt{(what 'sym) -> lst}} 102 | \label{sec:func-ref-W-(what 'sym) -> lst} 103 | 104 | 105 | Returns a list of all internal symbols that match the pattern string 106 | \texttt{sym}. See also \texttt{match}, \texttt{who} and \texttt{can}. 107 | 108 | 109 | \begin{wideverbatim} 110 | : (what "cd@dr") 111 | -> (cdaddr cdaadr cddr cddddr cdddr cddadr cdadr) 112 | \end{wideverbatim} 113 | 114 | 115 | \section*{\texttt{(who 'any) -> lst}} 116 | \label{sec:func-ref-W-(who 'any) -> lst} 117 | 118 | 119 | Returns a list of all functions or method definitions that contain the 120 | atom or pattern \texttt{any}. See also \texttt{match}, \texttt{what} and \texttt{can}. 121 | 122 | 123 | \begin{wideverbatim} 124 | : (who 'caddr) # Who is using 'caddr'? 125 | -> ($dat lint1 expDat datStr $tim tim$ mail _gen dat$ datSym) 126 | 127 | : (who "Type error") 128 | -> ((mis> . +Link) *Uni (mis> . +Joint)) 129 | 130 | : (more (who "Type error") pp) # Pretty print all results 131 | (dm (mis> . +Link) (Val Obj) 132 | (and 133 | Val 134 | (nor (isa (: type) Val) (canQuery Val)) 135 | "Type error" ) ) 136 | . # Stop 137 | -> T 138 | \end{wideverbatim} 139 | 140 | 141 | \section*{\texttt{(wipe 'sym|lst) -> sym|lst}} 142 | \label{sec:func-ref-W-(wipe 'sym|lst) -> sym|lst} 143 | 144 | 145 | Clears the \texttt{VAL} and the property list of \texttt{sym}, or of all symbols in 146 | the list \texttt{lst}. When a symbol is an external symbol, its state is also 147 | set to ``not loaded''. Does nothing when \texttt{sym} is an external symbol that 148 | has been modified or deleted (``dirty''). 149 | 150 | 151 | \begin{wideverbatim} 152 | : (setq A (1 2 3 4)) 153 | -> (1 2 3 4) 154 | : (put 'A 'a 1) 155 | -> 1 156 | : (put 'A 'b 2) 157 | -> 2 158 | : (show 'A) 159 | A (1 2 3 4) 160 | b 2 161 | a 1 162 | -> A 163 | : (wipe 'A) 164 | -> A 165 | : (show 'A) 166 | A NIL 167 | -> A 168 | \end{wideverbatim} 169 | 170 | 171 | \section*{\texttt{(with 'sym . prg) -> any}} 172 | \label{sec:func-ref-W-(with 'sym . prg) -> any} 173 | 174 | 175 | Saves the current object \texttt{This} and sets it to the new value \texttt{sym}. Then 176 | \texttt{prg} is executed, and \texttt{This} is restored to its previous value. The 177 | return value is the result of \texttt{prg}. Used typically to access the local 178 | data of \texttt{sym} in the same manner as inside a method body. \texttt{prg} is not 179 | executed (and \texttt{NIL} is returned) when \texttt{sym} is \texttt{NIL}. \texttt{(with 'X . prg)} 180 | is equivalent to \texttt{(let? This 'X . prg)}. 181 | 182 | 183 | \begin{wideverbatim} 184 | : (put 'X 'a 1) 185 | -> 1 186 | : (put 'X 'b 2) 187 | -> 2 188 | : (with 'X (list (: a) (: b))) 189 | -> (1 2) 190 | \end{wideverbatim} 191 | 192 | 193 | \section*{\texttt{(wr 'cnt ..) -> cnt}} 194 | \label{sec:func-ref-W-(wr 'cnt ..) -> cnt} 195 | 196 | 197 | Writes all \texttt{cnt} arguments as raw bytes to the current output channel. 198 | See also \texttt{rd} and \texttt{pr}. 199 | 200 | 201 | \begin{wideverbatim} 202 | : (out "x" (wr 1 255 257)) # Write to "x" 203 | -> 257 204 | : (hd "x") 205 | 00000000 01 FF 01 ... 206 | -> NIL 207 | \end{wideverbatim} 208 | 209 | 210 | \section*{\texttt{(wrap 'cnt 'lst) -> sym}} 211 | \label{sec:func-ref-W-(wrap 'cnt 'lst) -> sym} 212 | 213 | 214 | Returns a transient symbol with all characters in \texttt{lst} \texttt{pack}ed in lines with a maximal length of \texttt{cnt}. See also \texttt{tab}, \texttt{align} and 215 | \texttt{center}. 216 | 217 | 218 | \begin{wideverbatim} 219 | : (wrap 20 (chop "The quick brown fox jumps over the lazy dog")) 220 | -> "The quick brown fox^Jjumps over the lazy^Jdog" 221 | : (wrap 8 (chop "The quick brown fox jumps over the lazy dog")) 222 | -> "The^Jquick^Jbrown^Jfox^Jjumps^Jover the^Jlazy dog" 223 | \end{wideverbatim} 224 | 225 | 226 | -------------------------------------------------------------------------------- /mainmatter/function-ref-X.tex: -------------------------------------------------------------------------------- 1 | %%%%%%%%%%%%%%%%%%%%% chapter.tex %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2 | % 3 | % sample chapter 4 | % 5 | % Use this file as a template for your own input. 6 | % 7 | %%%%%%%%%%%%%%%%%%%%%%%% Springer-Verlag %%%%%%%%%%%%%%%%%%%%%%%%%% 8 | %\motto{Use the template \emph{chapter.tex} to style the various elements of your chapter content.} 9 | 10 | 11 | 12 | \chapter{Symbols starting with X} 13 | \label{cha:func-ref-X-functions-starting-with-X} 14 | 15 | \section*{\texttt{(xchg 'var 'var ..) -> any}} 16 | \label{sec:func-ref-X-(xchg 'var 'var ..) -> any} 17 | 18 | 19 | Exchange the values of successive \texttt{var} argument pairs. 20 | 21 | 22 | \begin{wideverbatim} 23 | : (setq A 1 B 2 C '(a b c)) 24 | -> (a b c) 25 | : (xchg 'A C 'B (cdr C)) 26 | -> 2 27 | : A 28 | -> a 29 | : B 30 | -> b 31 | : C 32 | -> (1 2 c) 33 | \end{wideverbatim} 34 | 35 | 36 | \section*{\texttt{(xor 'any 'any) -> flg}} 37 | \label{sec:func-ref-X-(xor 'any 'any) -> flg} 38 | 39 | 40 | Returns T if exactly one of the arguments evaluates to non-\texttt{NIL}. 41 | 42 | 43 | \begin{wideverbatim} 44 | : (xor T NIL) 45 | -> T 46 | : (xor T T) 47 | -> NIL 48 | \end{wideverbatim} 49 | 50 | 51 | \section*{\texttt{(x| 'num ..) -> num}} 52 | \label{sec:func-ref-X-(x| 'num ..) -> num} 53 | 54 | 55 | Returns the bitwise \texttt{XOR} of all \texttt{num} arguments. When one of the 56 | arguments evaluates to \texttt{NIL}, it is returned immediately. See also \texttt{\&}, 57 | \texttt{|} and \texttt{bit?}. 58 | 59 | 60 | \begin{wideverbatim} 61 | : (x| 2 7) 62 | -> 5 63 | : (x| 2 7 1) 64 | -> 4 65 | \end{wideverbatim} 66 | 67 | 68 | -------------------------------------------------------------------------------- /mainmatter/function-ref-Y.tex: -------------------------------------------------------------------------------- 1 | %%%%%%%%%%%%%%%%%%%%% chapter.tex %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2 | % 3 | % sample chapter 4 | % 5 | % Use this file as a template for your own input. 6 | % 7 | %%%%%%%%%%%%%%%%%%%%%%%% Springer-Verlag %%%%%%%%%%%%%%%%%%%%%%%%%% 8 | %\motto{Use the template \emph{chapter.tex} to style the various elements of your chapter content.} 9 | 10 | 11 | 12 | \chapter{Symbols starting with Y} 13 | \label{cha:func-ref-Y-functions-starting-with-Y} 14 | 15 | \section*{\texttt{(yield 'any ['sym]) -> any}} 16 | \label{sec:func-ref-Y-(yield 'any ['sym]) -> any} 17 | 18 | 19 | (64-bit version only) Transfers control from the current 20 | \emph{coroutine} back to the caller (when the \texttt{sym} 21 | tag is not given), or to some other coroutine (specified by \texttt{sym}) to 22 | continue execution at the point where that coroutine had called \texttt{yield} 23 | before. In the first case, the value \texttt{any} will be returned from the 24 | corresponding \texttt{co} call, in the second case it will be the return value 25 | of that \texttt{yield} call. See also \texttt{stack}, \texttt{catch} and \texttt{throw}. 26 | 27 | 28 | \begin{wideverbatim} 29 | : (co "rt1" # Start first routine 30 | (msg (yield 1) " in rt1 from rt2") # Return '1', wait for value from "rt2" 31 | 7 ) # Then return '7' 32 | -> 1 33 | 34 | : (co "rt2" # Start second routine 35 | (yield 2 "rt1") ) # Send '2' to "rt1" 36 | 2 in rt1 from rt2 37 | -> 7 38 | \end{wideverbatim} 39 | 40 | 41 | \section*{\texttt{(yoke 'any ..) -> any}} 42 | \label{sec:func-ref-Y-(yoke 'any ..) -> any} 43 | 44 | 45 | Inserts one or several new elements \texttt{any} in front of the list in the 46 | current \texttt{make} environment. \texttt{yoke} returns the last inserted argument. 47 | See also \texttt{link}, \texttt{chain} and \texttt{made}. 48 | 49 | 50 | \begin{wideverbatim} 51 | : (make (link 2 3) (yoke 1) (link 4)) 52 | -> (1 2 3 4) 53 | \end{wideverbatim} 54 | 55 | 56 | -------------------------------------------------------------------------------- /mainmatter/function-ref-Z.tex: -------------------------------------------------------------------------------- 1 | %%%%%%%%%%%%%%%%%%%%% chapter.tex %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2 | % 3 | % sample chapter 4 | % 5 | % Use this file as a template for your own input. 6 | % 7 | %%%%%%%%%%%%%%%%%%%%%%%% Springer-Verlag %%%%%%%%%%%%%%%%%%%%%%%%%% 8 | %\motto{Use the template \emph{chapter.tex} to style the various elements of your chapter content.} 9 | 10 | 11 | 12 | \chapter{Symbols starting with Z} 13 | \label{cha:func-ref-Z-functions-starting-with-Z} 14 | 15 | 16 | \section*{\texttt{*Zap}} 17 | \label{sec:func-ref-Z-*Zap} 18 | 19 | 20 | A global variable holding a list and a pathname. If given, and the value 21 | of \texttt{*Solo} is \texttt{NIL}, external symbols which are no longer accessible can 22 | be collected in the CAR, e.g. during DB tree processing, and written to 23 | the file in the CDR at the next \texttt{commit}. A (typically periodic) call to 24 | \texttt{zap\_} will clean them up later. 25 | 26 | 27 | \begin{wideverbatim} 28 | : (setq *Zap '(NIL . "db/app/_zap")) 29 | -> "db/app/_zap" 30 | \end{wideverbatim} 31 | 32 | 33 | \section*{\texttt{(zap 'sym) -> sym}} 34 | \label{sec:func-ref-Z-(zap 'sym) -> sym} 35 | 36 | 37 | ``Delete'' the symbol \texttt{sym}. For internal symbols, that means to remove it 38 | from the internal index, effectively transforming it to a transient 39 | symbol. For external symbols, it means to mark it as ``deleted'', so that 40 | upon a later \texttt{commit} it will be removed from the database file. See 41 | also \texttt{intern}. 42 | 43 | 44 | \begin{wideverbatim} 45 | : (de foo (Lst) (car Lst)) # 'foo' calls 'car' 46 | -> foo 47 | : (zap 'car) # Delete the symbol 'car' 48 | -> "car" 49 | : (pp 'foo) 50 | (de foo (Lst) 51 | ("car" Lst) ) # 'car' is now a transient symbol 52 | -> foo 53 | : (foo (1 2 3)) # 'foo' still works 54 | -> 1 55 | : (car (1 2 3)) # Reader returns a new 'car' symbol 56 | !? (car (1 2 3)) 57 | car -- Undefined 58 | ? 59 | \end{wideverbatim} 60 | 61 | 62 | \section*{\texttt{(zapTree 'sym)}} 63 | \label{sec:func-ref-Z-(zapTree 'sym)} 64 | 65 | 66 | Recursively deletes a tree structure from the database. See also \texttt{tree}, 67 | \texttt{chkTree} and \texttt{prune}. 68 | 69 | 70 | \begin{wideverbatim} 71 | : (zapTree (cdr (root (tree 'nm '+Item)))) 72 | \end{wideverbatim} 73 | 74 | 75 | \section*{\texttt{(zap\_)}} 76 | \label{sec:func-ref-Z-(zap)} 77 | 78 | Delayed deletion (with zap) of external symbols which were collected 79 | e.g. during DB tree processing. An auxiliary file (with the name taken 80 | from the CDR of the value of \texttt{*Zap}, concatenated with a 81 | ``\texttt{\_}'' character) is used as an intermediary file. 82 | 83 | 84 | \begin{wideverbatim} 85 | : *Zap 86 | -> (NIL . "db/app/Z") 87 | : (call 'ls "-l" "db/app") 88 | ... 89 | -rw-r--r-- 1 abu abu 1536 2007-06-23 12:34 Z 90 | -rw-r--r-- 1 abu abu 1280 2007-05-23 12:15 Z_ 91 | ... 92 | : (zap_) 93 | ... 94 | : (call 'ls "-l" "db/app") 95 | ... 96 | -rw-r--r-- 1 abu abu 1536 2007-06-23 12:34 Z_ 97 | ... 98 | \end{wideverbatim} 99 | 100 | 101 | \section*{\texttt{(zero var ..) -> 0} } 102 | \label{sec:(zero var ..) -> 0} 103 | 104 | Stores \texttt{0} in all \texttt{var} arguments. See also \texttt{one}, \texttt{on}, \texttt{off} and 105 | \texttt{onOff}. 106 | 107 | 108 | \begin{wideverbatim} 109 | : (zero A B) 110 | -> 0 111 | : A 112 | -> 0 113 | : B 114 | -> 0 115 | \end{wideverbatim} 116 | 117 | 118 | -------------------------------------------------------------------------------- /mainmatter/parts/appendix.tex: -------------------------------------------------------------------------------- 1 | %%%%%%%%%%%%%%%%%%%%%part.tex%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2 | % 3 | % sample part title 4 | % 5 | % Use this file as a template for your own input. 6 | % 7 | %%%%%%%%%%%%%%%%%%%%%%%% Springer %%%%%%%%%%%%%%%%%%%%%%%%%% 8 | 9 | \begin{partbacktext} 10 | \part{Appendix} 11 | \noindent Licence and Links 12 | \end{partbacktext} -------------------------------------------------------------------------------- /mainmatter/parts/part-99-lisp-problems.tex: -------------------------------------------------------------------------------- 1 | %%%%%%%%%%%%%%%%%%%%%part.tex%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2 | % 3 | % sample part title 4 | % 5 | % Use this file as a template for your own input. 6 | % 7 | %%%%%%%%%%%%%%%%%%%%%%%% Springer %%%%%%%%%%%%%%%%%%%%%%%%%% 8 | 9 | \begin{partbacktext} 10 | \part{Ninety-Nine Lisp Problems} 11 | \noindent Based on a Prolog problem list by werner.hett@hti.bfh.ch. The original 12 | is at 13 | 14 | \href{https://prof.ti.bfh.ch/hew1/informatik3/prolog/p-99}{https://prof.ti.bfh.ch/hew1/informatik3/prolog/p-99}. 15 | 16 | Work in progress! Until now, only about half of the problems are solved. 17 | Another possibility, of course, would be translating the Prolog 18 | solutions to Pilog ;-) 19 | \end{partbacktext} -------------------------------------------------------------------------------- /mainmatter/parts/part-function-ref.tex: -------------------------------------------------------------------------------- 1 | %%%%%%%%%%%%%%%%%%%%%part.tex%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2 | % 3 | % sample part title 4 | % 5 | % Use this file as a template for your own input. 6 | % 7 | %%%%%%%%%%%%%%%%%%%%%%%% Springer %%%%%%%%%%%%%%%%%%%%%%%%%% 8 | 9 | \begin{partbacktext} 10 | \part{Function Reference} 11 | \noindent Complete reference for all build-in PicoLisp functions with 12 | links to related functions and examples of use. 13 | -------------------------------------------------------------------------------- /mainmatter/parts/part-rosettacode.tex: -------------------------------------------------------------------------------- 1 | %%%%%%%%%%%%%%%%%%%%%part.tex%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2 | % 3 | % sample part title 4 | % 5 | % Use this file as a template for your own input. 6 | % 7 | %%%%%%%%%%%%%%%%%%%%%%%% Springer %%%%%%%%%%%%%%%%%%%%%%%%%% 8 | 9 | \begin{partbacktext} 10 | \part{Rosetta Code} 11 | \noindent Rosetta Code 12 | (\href{http://rosettacode.org/wiki/Rosetta_Code}{http://rosettacode.org/wiki/Rosetta\_Code}) 13 | is a programming chrestomathy site. The idea is to present solutions 14 | to the same task in as many different languages as possible, to 15 | demonstrate how languages are similar and different, and to aid a 16 | person with a grounding in one approach to a problem in learning 17 | another. Rosetta Code currently\footnote{accessed online 21-08-2012} 18 | has 600 tasks, 97 draft tasks, and is aware of 471 languages. 19 | \end{partbacktext} -------------------------------------------------------------------------------- /mainmatter/parts/part.tex: -------------------------------------------------------------------------------- 1 | %%%%%%%%%%%%%%%%%%%%%part.tex%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2 | % 3 | % sample part title 4 | % 5 | % Use this file as a template for your own input. 6 | % 7 | %%%%%%%%%%%%%%%%%%%%%%%% Springer %%%%%%%%%%%%%%%%%%%%%%%%%% 8 | 9 | \begin{partbacktext} 10 | \part{Part Title} 11 | \noindent Use the template \emph{part.tex} together with the Springer document class SVMono (monograph-type books) or SVMult (edited books) to style your part title page and, if desired, a short introductory text (maximum one page) on its verso page in the Springer layout. 12 | 13 | \end{partbacktext} -------------------------------------------------------------------------------- /mainmatter/rosettacode-J.tex: -------------------------------------------------------------------------------- 1 | %%%%%%%%%%%%%%%%%%%%% chapter.tex %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2 | % 3 | % sample chapter 4 | % 5 | % Use this file as a template for your own input. 6 | % 7 | %%%%%%%%%%%%%%%%%%%%%%%% Springer-Verlag %%%%%%%%%%%%%%%%%%%%%%%%%% 8 | %\motto{Use the template \emph{chapter.tex} to style the various elements of your chapter content.} 9 | 10 | \chapter{Rosetta Code Tasks starting with J} 11 | 12 | \section*{JSON} 13 | 14 | Load a \href{http://en.wikipedia.org/wiki/JSON}{JSON} string into a data 15 | structure. Also create a new data structure and serialize it into JSON. 16 | Use objects and arrays (as appropriate for your language) and make sure 17 | your JSON is valid 18 | (\href{http://www.jsonlint.com/}{http://www.jsonlint.com/}). However, 19 | beware that this web application accepts extra commas, so {[}1,2,3,{]} 20 | validates as correct, which is at odds with the grammar given at 21 | json.org \href{http://www.json.org/fatfree.html}{{[}1{]}}. 22 | 23 | \begin{wideverbatim} 24 | 25 | PicoLisp has no JSON library, but it is easy enough to write one. The following 26 | supports only fixpoint numbers (no floating point, as it doesn't exist in 27 | PicoLisp), no arrays (uses lists instead), and no unicode escapes (UTF-8 can be 28 | used directly): 29 | 30 | (de checkJson (X Item) 31 | (unless (= X Item) 32 | (quit "Bad JSON" Item) ) ) 33 | 34 | (de readJson () 35 | (case (read "_") 36 | ("{" 37 | (make 38 | (for (X (readJson) (not (= "}" X)) (readJson)) 39 | (checkJson ":" (readJson)) 40 | (link (cons X (readJson))) 41 | (T (= "}" (setq X (readJson)))) 42 | (checkJson "," X) ) ) ) 43 | ("[" 44 | (make 45 | (link T) # Array marker 46 | (for (X (readJson) (not (= "]" X)) (readJson)) 47 | (link X) 48 | (T (= "]" (setq X (readJson)))) 49 | (checkJson "," X) ) ) ) 50 | (T 51 | (let X @ 52 | (if (and (= "-" X) (format (peek))) 53 | (- (read)) 54 | X ) ) ) ) ) 55 | 56 | (de printJson (Item) # For simplicity, without indentation 57 | (cond 58 | ((atom Item) (if Item (print @) (prin "{}"))) 59 | ((=T (car Item)) 60 | (prin "[") 61 | (map 62 | '((X) 63 | (printJson (car X)) 64 | (and (cdr X) (prin ", ")) ) 65 | (cdr Item) ) 66 | (prin "]") ) 67 | (T 68 | (prin "{") 69 | (map 70 | '((X) 71 | (print (caar X)) 72 | (prin ": ") 73 | (printJson (cdar X)) 74 | (and (cdr X) (prin ", ")) ) 75 | Item ) 76 | (prin "}") ) ) ) 77 | 78 | \end{wideverbatim} 79 | 80 | \begin{wideverbatim} 81 | 82 | This reads/prints JSON from/to files, pipes, sockets etc. To read from a string, 83 | a pipe can be used: 84 | 85 | : (pipe (prinl "{ \"foo\": 1, \"bar\": [10, \"apples\"] }") 86 | (readJson) ) 87 | -> (("foo" . 1) ("bar" T 10 "apples")) 88 | 89 | : (printJson 90 | (quote 91 | ("name" . "Smith") 92 | ("age" . 25) 93 | ("address" 94 | ("street" . "21 2nd Street") 95 | ("city" . "New York") 96 | ("state" . "NY") 97 | ("zip" . "10021") ) 98 | ("phone" T "212 555-1234" "646 555-4567") ) ) 99 | {"name": "Smith", "age": 25, ... {"street": ... "phone": ["212 555-1234", ... 100 | 101 | \end{wideverbatim} 102 | 103 | \pagebreak{} 104 | \section*{Jensen's Device} 105 | 106 | This task is an exercise in 107 | \href{http://en.wikipedia.org/wiki/Call-by-name\#Call\_by\_name}{call 108 | by name}. 109 | 110 | \textbf{Jensen's Device} is a computer programming technique devised 111 | by Danish computer scientist 112 | \href{http://en.wikipedia.org/wiki/J\%C3\%B8rn\_Jensen}{Jørn Jensen} 113 | after studying the \emph{ALGOL 60} Report. 114 | 115 | The following program was proposed to illustrate the technique. It 116 | computes the 100th 117 | \href{http://en.wikipedia.org/wiki/Harmonic\_number}{harmonic number}: 118 | 119 | \begin{wideverbatim} 120 | begin 121 | integer i; 122 | real procedure sum (i, lo, hi, term); 123 | value lo, hi; 124 | integer i, lo, hi; 125 | real term; 126 | comment term is passed by-name, and so is i; 127 | begin 128 | real temp; 129 | temp := 0; 130 | for i := lo step 1 until hi do 131 | temp := temp + term; 132 | sum := temp 133 | end; 134 | comment note the correspondence between 135 | the mathematical notation and the call to sum; 136 | print (sum (i, 1, 100, 1/i)) 137 | end 138 | \end{wideverbatim} 139 | 140 | The above exploits 141 | \href{http://en.wikipedia.org/wiki/Call-by-name\#Call\_by\_name}{call 142 | by name} to produce the correct answer (5.187\ldots{}). It depends 143 | on the assumption that an expression passed as an actual parameter to 144 | a procedure would be re-evaluated every time the corresponding formal 145 | parameter's value was required. If the last parameter to \emph{sum} 146 | had been passed by value, and assuming the initial value of \emph{i} 147 | were 1, the result would have been 100 × 1/1 = 100. 148 | 149 | Moreover, the \emph{first} parameter to \emph{sum}, representing the 150 | ``bound'' variable of the summation, must also be passed by name, 151 | otherwise it would not be possible to compute the values to be added. 152 | (On the other hand, the global variable does not have to use the same 153 | identifier, in this case \emph{i}, as the formal parameter.) 154 | 155 | \href{http://en.wikipedia.org/wiki/Donald\_Knuth}{Donald Knuth} later 156 | proposed the \emph{Man or Boy Test} as a more 157 | rigorous exercise. 158 | 159 | 160 | \begin{wideverbatim} 161 | 162 | (scl 6) 163 | 164 | (de jensen (I Lo Hi Term) 165 | (let Temp 0 166 | (set I Lo) 167 | (while (>= Hi (val I)) 168 | (inc 'Temp (Term)) 169 | (inc I) ) 170 | Temp ) ) 171 | 172 | (let I (box) # Create indirect reference 173 | (format 174 | (jensen I 1 100 '(() (*/ 1.0 (val I)))) 175 | *Scl ) ) 176 | 177 | Output: 178 | 179 | -> "5.187383" 180 | 181 | \end{wideverbatim} 182 | 183 | \pagebreak{} 184 | \section*{Joystick position} 185 | 186 | The task is to determine the joystick position and represent this on 187 | the display via a crosshair. For a centred joystick, the crosshair 188 | should appear in the centre of the screen. If the joystick is pushed 189 | left or right, then the cross hair should move left or right according 190 | to the extent that the joystick is pushed. If the joystick is pushed 191 | forward or pulled back, then the crosshair should move up or down 192 | according to the extent that that joystick is pushed or pulled. The 193 | edges of the display represent maximum extents for joystick movement. 194 | For example, a joystick pushed fully forward would raise the crosshair 195 | to the top centre of the screen. A joystick pulled backwards and to 196 | the right would move the crosshair to the bottom right of the screen 197 | (except for a small area reserved to show joystick status). 198 | Implementations can use a graphical display method to produce the 199 | crosshair, or alternatively represent the crosshair using a plus 200 | symbol on a terminal, and move the plus symbol position according to 201 | the joystick. The bottom part of the display can hide or show an 202 | alphanumeric sequence to represent the buttons pressed. For example, 203 | if pushbuttons 1,4 and 10 are depressed, we could display ``1 4 A''. 204 | The implemented code should continue to redraw the crosshair according 205 | to the joystick position and show the current pushbutton statuses 206 | until the task is terminated. Digital joysticks that produce no extent 207 | data, should have their position indicated as full extent movement of 208 | the crosshair. 209 | 210 | For the purpose of this task, we assume that the joystick is calibrated 211 | and that the first joystick is being used. The task implementer could at 212 | their option provide a solution that includes a joystick selection 213 | facility, enabling the user to choose which joystick is to be used for 214 | this task. 215 | 216 | 217 | \begin{wideverbatim} 218 | 219 | This is for the 64-bit version. 220 | 221 | Note: The code is not yet tested with a real joystick (I don't have one), it was 222 | just simulated with dummy functions. Can somebody having a joystick please test 223 | it, and remove this message? 224 | 225 | (load "@lib/openGl.l") 226 | 227 | (setq *JoyX 0.0 *JoyY 0.0) 228 | 229 | (glutInit) 230 | (glutInitDisplayMode (| GLUT_RGBA GLUT_DOUBLE GLUT_ALPHA GLUT_DEPTH)) 231 | (glutInitWindowSize 400 400) 232 | (glutCreateWindow "Joystick") 233 | 234 | (glClearColor 0.3 0.3 0.5 0) 235 | 236 | (displayPrg 237 | (glClear GL_COLOR_BUFFER_BIT) 238 | (glBegin GL_LINES) 239 | (glVertex2f *JoyX (- *JoyY 0.1)) # Draw crosshair 240 | (glVertex2f *JoyX (+ *JoyY 0.1)) 241 | (glVertex2f (- *JoyX 0.1) *JoyY) 242 | (glVertex2f (+ *JoyX 0.1) *JoyY) 243 | (glEnd) 244 | (glFlush) 245 | (glutSwapBuffers) ) 246 | 247 | # Track joystick position 248 | (native `*GlutLib "glutJoystickFunc" NIL 249 | (lisp 'joystickFunc 250 | '((Btn X Y Z) 251 | (msg # Display buttons 252 | (make 253 | (for (B 1 (n0 Btn) (inc B)) 254 | (and (bit? 1 Btn) (link B)) 255 | (setq Btn (>> 1 Btn)) ) ) ) 256 | (setq # Move crosshair 257 | *JoyX (*/ X 1.0 1000) 258 | *JoyY (*/ Y 1.0 1000) ) 259 | (glutPostRedisplay) ) ) 260 | 100 ) 261 | 262 | # Exit upon mouse click 263 | (mouseFunc '((Btn State X Y) (bye))) 264 | (glutMainLoop) 265 | 266 | \end{wideverbatim} 267 | 268 | \pagebreak{} 269 | \section*{Jump anywhere} 270 | 271 | \emph{Imperative programs} like to jump around, but some languages 272 | restrict these jumps. Many structured languages restrict their 273 | \emph{conditional structures} and \emph{loops} to \emph{local jumps} 274 | within a function. Some assembly languages limit certain jumps or 275 | branches to a small range. 276 | 277 | This task is demonstrate a local jump and a global jump and the 278 | various other types of jumps that the language supports. For the 279 | purpose of this task, the jumps need not be used for a single purpose 280 | and you have the freedom to use these jumps for different purposes. 281 | You may also defer to more specific tasks, like \emph{Exceptions} or 282 | \emph{Generator}. This task provides a ``grab bag'' for several types 283 | of jumps. There are \emph{non-local jumps} across function calls, or 284 | \emph{long jumps} to anywhere within a program. Anywhere means not 285 | only to the tops of functions! 286 | 287 | \begin{itemize} 288 | \item 289 | Some languages can \emph{go to} any global label in a program. 290 | \item 291 | Some languages can break multiple function calls, also known as 292 | \emph{unwinding the call stack}. 293 | \item 294 | Some languages can save a \emph{continuation}. The program can later 295 | continue from the same place. So you can jump anywhere, but only if 296 | you have a previous visit there (to save the continuation). 297 | \end{itemize} 298 | 299 | These jumps are not all alike. A simple \emph{goto} never touches the 300 | call stack. A continuation saves the call stack, so you can continue a 301 | function call after it ends. 302 | 303 | Use your language to demonstrate the various types of jumps that it 304 | supports. Because the possibilities vary by language, this task is not 305 | specific. You have the freedom to use these jumps for different 306 | purposes. You may also defer to more specific tasks, like 307 | \emph{Exceptions} or \emph{Generator}. 308 | 309 | \begin{wideverbatim} 310 | 311 | PicoLisp supports non-local jumps to a previously setup environment (see 312 | [[Exceptions#PicoLisp|exceptions]]) via 313 | '[http://software-lab.de/doc/refC.html#catch catch]' and 314 | '[http://software-lab.de/doc/refT.html#throw throw]', or to some location in 315 | another coroutine with '[http://software-lab.de/doc/refY.html#yield yield]' (see 316 | [[Generator#PicoLisp|generator]]). 317 | 318 | '[http://software-lab.de/doc/refQ.html#quit quit]' is similar to 'throw', but 319 | doesn't require a corresponding 'catch', as it directly jumps to the error 320 | handler (where the program may catch that error again). 321 | 322 | There is no 'go' or 'goto' function in PicoLisp, but it can be emulated with 323 | normal list processing functions. This allows "jumps" to arbitrary locations 324 | within (the same or other) functions. The following example implements a "loop": 325 | 326 | (de foo (N) 327 | (prinl "This is 'foo'") 328 | (printsp N) 329 | (or (=0 (dec 'N)) (run (cddr foo))) ) 330 | 331 | Test: 332 | 333 | : (foo 7) 334 | This is 'foo' 335 | 7 6 5 4 3 2 1 -> 0 336 | 337 | \end{wideverbatim} 338 | 339 | 340 | 341 | % \input{referenc} 342 | -------------------------------------------------------------------------------- /mainmatter/rosettacode-Q.tex: -------------------------------------------------------------------------------- 1 | %%%%%%%%%%%%%%%%%%%%% chapter.tex %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2 | % 3 | % sample chapter 4 | % 5 | % Use this file as a template for your own input. 6 | % 7 | %%%%%%%%%%%%%%%%%%%%%%%% Springer-Verlag %%%%%%%%%%%%%%%%%%%%%%%%%% 8 | %\motto{Use the template \emph{chapter.tex} to style the various elements of your chapter content.} 9 | 10 | \chapter{Rosetta Code Tasks starting with Q} 11 | 12 | \section*{Queue/Definition} 13 | 14 | \textbf{Data Structure}\\ This illustrates a data structure, a means of 15 | storing data within a program. 16 | 17 | You may see other such structures in the 18 | \emph{Data Structures} category. 19 | 20 | % % animated graphic, no way to print 21 | % \begin{figure}[H] 22 | % \centering 23 | % \includegraphics[scale=.6]{graphics/Fifo.gif} 24 | % \end{figure} 25 | 26 | \textbf{Task} 27 | 28 | Implement a FIFO queue. Elements are added at one side and popped from 29 | the other in the order of insertion. 30 | 31 | Operations: 32 | 33 | \begin{itemize} 34 | \item 35 | push (aka \emph{enqueue}) - add element 36 | \item 37 | pop (aka \emph{dequeue}) - pop first element 38 | \item 39 | empty - return truth value when empty 40 | \end{itemize} 41 | 42 | Errors: 43 | 44 | \begin{itemize} 45 | \item 46 | handle the error of trying to pop from an empty queue (behavior 47 | depends on the language and platform) 48 | \end{itemize} 49 | 50 | See \emph{FIFO (usage)} for the built-in FIFO or 51 | queue of your language or standard library. 52 | 53 | 54 | \begin{wideverbatim} 55 | 56 | The built-in function 'fifo' maintains a queue in a circular list, with direct 57 | access to the first and the last cell 58 | 59 | (off Queue) # Clear Queue 60 | (fifo 'Queue 1) # Store number '1' 61 | (fifo 'Queue 'abc) # an internal symbol 'abc' 62 | (fifo 'Queue "abc") # a transient symbol "abc" 63 | (fifo 'Queue '(a b c)) # and a list (a b c) 64 | Queue # Show the queue 65 | 66 | Output: 67 | 68 | ->((a b c) 1 abc "abc" .) 69 | 70 | \end{wideverbatim} 71 | 72 | \pagebreak{} 73 | \section*{Queue/Usage} 74 | 75 | 76 | \textbf{Data Structure}\\ This illustrates a data structure, a means of 77 | storing data within a program. 78 | 79 | You may see other such structures in the \emph{Data Structures} 80 | category. 81 | 82 | % % animated graphic, no way to print 83 | % \begin{figure}[H] 84 | % \centering 85 | % \includegraphics[scale=.6]{graphics/Fifo.gif} 86 | % \end{figure} 87 | 88 | \textbf{Task} 89 | 90 | Create a queue data structure and demonstrate its operations. (For 91 | implementations of queues, see the \emph{FIFO} task.) 92 | 93 | Operations: 94 | 95 | \begin{itemize} 96 | \item 97 | push (aka \emph{enqueue}) - add element 98 | \item 99 | pop (aka \emph{dequeue}) - pop first element 100 | \item 101 | empty - return truth value when empty 102 | \end{itemize} 103 | 104 | 105 | \begin{wideverbatim} 106 | 107 | Using the implementation from [[FIFO]]: 108 | (println (fifo 'Queue)) # Retrieve the number '1' 109 | (println (fifo 'Queue)) # Retrieve an internal symbol 'abc' 110 | (println (fifo 'Queue)) # Retrieve a transient symbol "abc" 111 | (println (fifo 'Queue)) # and a list (abc) 112 | (println (fifo 'Queue)) # Queue is empty -> NIL 113 | 114 | Output: 115 | 116 | 1 117 | abc 118 | "abc" 119 | (a b c) 120 | NIL 121 | 122 | \end{wideverbatim} 123 | 124 | \pagebreak{} 125 | \section*{Quine} 126 | 127 | 128 | A \href{http://en.wikipedia.org/wiki/Quine\_(computing)}{Quine} is a 129 | self-referential program that can, without any external access, output 130 | its own source. It is named after the 131 | \href{http://en.wikipedia.org/wiki/Willard\_Van\_Orman\_Quine}{philosopher 132 | and logician} who studied self-reference and quoting in natural 133 | language, as for example in the paradox ``\,`Yields falsehood when 134 | preceded by its quotation' yields falsehood when preceded by its 135 | quotation.'' 136 | 137 | ``Source'' has one of two meanings. It can refer to the text-based 138 | program source. For languages in which program source is represented as 139 | a data structure, ``source'' may refer to the data structure: quines in 140 | these languages fall into two categories: programs which print a textual 141 | representation of themselves, or expressions which evaluate to a data 142 | structure which is equivalent to that expression. 143 | 144 | The usual way to code a Quine works similarly to this paradox: The 145 | program consists of two identical parts, once as plain code and once 146 | \emph{quoted} in some way (for example, as a character string, or a 147 | literal data structure). The plain code then accesses the quoted code 148 | and prints it out twice, once unquoted and once with the proper 149 | quotation marks added. Often, the plain code and the quoted code have to 150 | be nested. 151 | 152 | Write a program that outputs its own source code in this way. If the 153 | language allows it, you may add a variant that accesses the code 154 | directly. You are not allowed to read any external files with the source 155 | code. The program should also contain some sort of self-reference, so 156 | constant expressions which return their own value which some top-level 157 | interpreter will print out. Empty programs producing no output are not 158 | allowed. 159 | 160 | There are several difficulties that one runs into when writing a quine, 161 | mostly dealing with quoting: 162 | 163 | \begin{itemize} 164 | \item 165 | Part of the code usually needs to be stored as a string or structural 166 | literal in the language, which needs to be quoted somehow. However, 167 | including quotation marks in the string literal itself would be 168 | troublesome because it requires them to be escaped, which then 169 | necessitates the escaping character (e.g. a backslash) in the string, 170 | which itself usually needs to be escaped, and so on. 171 | 172 | \begin{itemize} 173 | \item 174 | Some languages have a function for getting the ``source code 175 | representation'' of a string (i.e. adds quotation marks, etc.); in 176 | these languages, this can be used to circumvent the quoting problem. 177 | \item 178 | Another solution is to construct the quote character from its 179 | \emph{character code}, without having to 180 | write the quote character itself. Then the character is inserted 181 | into the string at the appropriate places. The ASCII code for 182 | double-quote is 34, and for single-quote is 39. 183 | \end{itemize} 184 | \item 185 | Newlines in the program may have to be reproduced as newlines in the 186 | string, which usually requires some kind of escape sequence (e.g. 187 | ``\textbackslash{}n''). This causes the same problem as above, where 188 | the escaping character needs to itself be escaped, etc. 189 | 190 | \begin{itemize} 191 | \item 192 | If the language has a way of getting the ``source code 193 | representation'', it usually handles the escaping of characters, so 194 | this is not a problem. 195 | \item 196 | Some languages allow you to have a string literal that spans 197 | multiple lines, which embeds the newlines into the string without 198 | escaping. 199 | \item 200 | Write the entire program on one line, for free-form languages (as 201 | you can see for some of the solutions here, they run off the edge of 202 | the screen), thus removing the need for newlines. However, this may 203 | be unacceptable as some languages require a newline at the end of 204 | the file; and otherwise it is still generally good style to have a 205 | newline at the end of a file. (The task is not clear on whether a 206 | newline is required at the end of the file.) Some languages have a 207 | print statement that appends a newline; which solves the 208 | newline-at-the-end issue; but others do not. 209 | \end{itemize} 210 | \end{itemize} 211 | 212 | See the nostalgia note under Fortran. 213 | 214 | 215 | \begin{wideverbatim} 216 | 217 | Using 'quote' (= 'lambda' in PicoLisp) 218 | 219 | ('((X) (list (lit X) (lit X))) '((X) (list (lit X) (lit X)))) 220 | 221 | Output: 222 | 223 | -> ('((X) (list (lit X) (lit X))) '((X) (list (lit X) (lit X)))) 224 | 225 | Using 'let' 226 | 227 | (let X '(list 'let 'X (lit X) X) (list 'let 'X (lit X) X)) 228 | 229 | Output: 230 | 231 | -> (let X '(list 'let 'X (lit X) X) (list 'let 'X (lit X) X)) 232 | 233 | \end{wideverbatim} 234 | 235 | 236 | 237 | % \input{referenc} 238 | -------------------------------------------------------------------------------- /mainmatter/rosettacode-X.tex: -------------------------------------------------------------------------------- 1 | %%%%%%%%%%%%%%%%%%%%% chapter.tex %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2 | % 3 | % sample chapter 4 | % 5 | % Use this file as a template for your own input. 6 | % 7 | %%%%%%%%%%%%%%%%%%%%%%%% Springer-Verlag %%%%%%%%%%%%%%%%%%%%%%%%%% 8 | %\motto{Use the template \emph{chapter.tex} to style the various elements of your chapter content.} 9 | 10 | \chapter{Rosetta Code Tasks starting with X} 11 | 12 | \section*{XML/DOM serialization} 13 | 14 | Create a simple DOM and having it serialize to: 15 | 16 | \begin{verbatim} 17 | 18 | 19 | 20 | Some text here 21 | 22 | 23 | \end{verbatim} 24 | 25 | 26 | \begin{wideverbatim} 27 | 28 | (load "@lib/xm.l") 29 | 30 | (xml? T) 31 | (xml '(root NIL (element NIL "Some text here"))) 32 | 33 | Output: 34 | 35 | 36 | 37 | Some text here 38 | 39 | 40 | \end{wideverbatim} 41 | 42 | \pagebreak{} 43 | \section*{XML/Input} 44 | 45 | Given the following XML fragment, extract the list of \emph{student 46 | names} using whatever means desired. If the only viable method is to 47 | use XPath, refer the reader to the task \emph{XML and XPath}. 48 | 49 | \begin{wideverbatim} 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | \end{wideverbatim} 60 | 61 | Expected Output 62 | 63 | \begin{verbatim} 64 | April 65 | Bob 66 | Chad 67 | Dave 68 | Émily 69 | \end{verbatim} 70 | 71 | 72 | \begin{wideverbatim} 73 | 74 | (load "@lib/xm.l") 75 | 76 | (mapcar 77 | '((L) (attr L 'Name)) 78 | (body (in "file.xml" (xml))) ) 79 | 80 | Output: 81 | 82 | -> ("April" "Bob" "Chad" "Dave" "Émily") 83 | 84 | \end{wideverbatim} 85 | 86 | \pagebreak{} 87 | \section*{XML/Output} 88 | 89 | Create a function that takes a list of character names and a list of 90 | corresponding remarks and returns an XML document of 91 | \texttt{\textless{}Character\textgreater{}} elements each with a name 92 | attributes and each enclosing its remarks. All 93 | \texttt{\textless{}Character\textgreater{}} elements are to be enclosed 94 | in turn, in an outer \texttt{\textless{}CharacterRemarks\textgreater{}} 95 | element. 96 | 97 | As an example, calling the function with the three names of: 98 | 99 | \begin{verbatim} 100 | April 101 | Tam O'Shanter 102 | Emily 103 | \end{verbatim} 104 | 105 | And three remarks of: 106 | 107 | \begin{verbatim} 108 | Bubbly: I'm > Tam and <= Emily 109 | Burns: "When chapman billies leave the street ..." 110 | Short & shrift 111 | \end{verbatim} 112 | 113 | Should produce the XML (but not necessarily with the indentation): 114 | 115 | \begin{wideverbatim} 116 | 117 | 118 | 119 | Bubbly: I'm > Tam and <= Emily 120 | 121 | 122 | Burns:"When chapman billies leave the street ..." 123 | 124 | 125 | Short & shrift 126 | 127 | 128 | 129 | \end{wideverbatim} 130 | 131 | The document may include an \texttt{\textless{}?xml?\textgreater{}} 132 | declaration and document type declaration, but these are optional. If 133 | attempting this task by direct string manipulation, the implementation 134 | \emph{must} include code to perform entity substitution for the 135 | characters that have entities defined in the XML 1.0 specification. 136 | 137 | Note: the example is chosen to show correct escaping of XML strings. 138 | Note too that although the task is written to take two lists of 139 | corresponding data, a single mapping/hash/dictionary of names to remarks 140 | is also acceptable. 141 | 142 | \pagebreak{} 143 | 144 | \textbf{Note to editors:} Program output with escaped characters will be 145 | viewed as the character on the page so you need to `escape-the-escapes' 146 | to make the RC entry display what would be shown in a plain text viewer 147 | (See \emph{this}). 148 | Alternately, output can be placed in \textless{}lang 149 | xml\textgreater{}\textless{}/lang\textgreater{} tags without any special 150 | treatment. 151 | 152 | 153 | 154 | \begin{wideverbatim} 155 | 156 | (load "@lib/xm.l") 157 | 158 | (de characterRemarks (Names Remarks) 159 | (xml 160 | (cons 161 | 'CharacterRemarks 162 | NIL 163 | (mapcar 164 | '((Name Remark) 165 | (list 'Character (list (cons 'name Name)) Remark) ) 166 | Names 167 | Remarks ) ) ) ) 168 | 169 | (characterRemarks 170 | '("April" "Tam O'Shanter" "Emily") 171 | (quote 172 | "I'm > Tam and <= Emily" 173 | "Burns: \"When chapman billies leave the street ..." 174 | "Short \& shrift" ) ) 175 | 176 | Output: 177 | 178 | 179 | I'm > Tam and \<= Emily 180 | Burns: \" 181 | When chapman billies leave the street ... 182 | Short \& shrift 183 | 184 | 185 | \end{wideverbatim} 186 | 187 | \pagebreak{} 188 | \section*{XML/XPath} 189 | 190 | Perform the following three XPath queries on the XML Document below: 191 | 192 | \begin{itemize} 193 | \item 194 | Retrieve the first ``item'' element 195 | \item 196 | Perform an action on each ``price'' element (print it out) 197 | \item 198 | Get an array of all the ``name'' elements 199 | \end{itemize} 200 | 201 | XML Document: 202 | 203 | \begin{wideverbatim} 204 | 205 |
206 | 207 | Invisibility Cream 208 | 14.50 209 | Makes you invisible 210 | 211 | 212 | Levitation Salve 213 | 23.99 214 | Levitate yourself for up to 3 hours per application 215 | 216 | 217 |
218 |
219 | 220 | Blork and Freen Instameal 221 | 4.95 222 | A tasty meal in a tablet; just add water 223 | 224 | 225 | Grob winglets 226 | 3.56 227 | Tender winglets of Grob. Just add water 228 | 229 |
230 |
231 | \end{wideverbatim} 232 | 233 | \begin{wideverbatim} 234 | 235 | (load "@lib/xm.l") 236 | 237 | (let Sections (body (in "file.xml" (xml))) 238 | (pretty (car (body (car Sections)))) 239 | (prinl) 240 | (for S Sections 241 | (for L (body S) 242 | (prinl (car (body L 'price))) ) ) 243 | (make 244 | (for S Sections 245 | (for L (body S) 246 | (link (car (body L 'name))) ) ) ) ) 247 | 248 | Output: 249 | 250 | (item 251 | ((upc . "123456789") (stock . "12")) 252 | (name NIL "Invisibility Cream") 253 | (price NIL "14.50") 254 | (description NIL "Makes you invisible") ) 255 | 14.50 256 | 23.99 257 | 4.95 258 | 3.56 259 | -> ("Invisibility Cream" "Levitation Salve" 260 | "Blork and Freen Instameal" "Grob winglets") 261 | 262 | \end{wideverbatim} 263 | 264 | \pagebreak{} 265 | \section*{Xiaolin Wu's line algorithm} 266 | 267 | Implement the 268 | \href{http://en.wikipedia.org/wiki/Xiaolin\_Wu\%27s\_line\_algorithm}{Xiaolin 269 | Wu's line algorithm} as described in Wikipedia. This algorithm draw 270 | antialiased lines. See \emph{Bresenham's line algorithm} for 271 | \emph{aliased} lines. 272 | 273 | 274 | \begin{wideverbatim} 275 | 276 | (scl 2) 277 | 278 | (de plot (Img X Y C) 279 | (set (nth Img (*/ Y 1.0) (*/ X 1.0)) (- 100 C)) ) 280 | 281 | (de ipart (X) 282 | (* 1.0 (/ X 1.0)) ) 283 | 284 | (de iround (X) 285 | (ipart (+ X 0.5)) ) 286 | 287 | (de fpart (X) 288 | (\% X 1.0) ) 289 | 290 | (de rfpart (X) 291 | (- 1.0 (fpart X)) ) 292 | 293 | 294 | \end{wideverbatim} 295 | 296 | \begin{wideverbatim} 297 | 298 | 299 | (de xiaolin (Img X1 Y1 X2 Y2) 300 | (let (DX (- X2 X1) DY (- Y2 Y1)) 301 | (use (Grad Xend Yend Xgap Xpxl1 Ypxl1 Xpxl2 Ypxl2 Intery) 302 | (when (> (abs DY) (abs DX)) 303 | (xchg 'X1 'Y1 'X2 'Y2) ) 304 | (when (> X1 X2) 305 | (xchg 'X1 'X2 'Y1 'Y2) ) 306 | (setq 307 | Grad (*/ DY 1.0 DX) 308 | Xend (iround X1) 309 | Yend (+ Y1 (*/ Grad (- Xend X1) 1.0)) 310 | Xgap (rfpart (+ X1 0.5)) 311 | Xpxl1 Xend 312 | Ypxl1 (ipart Yend) ) 313 | (plot Img Xpxl1 Ypxl1 (*/ (rfpart Yend) Xgap 1.0)) 314 | (plot Img Xpxl1 (+ 1.0 Ypxl1) (*/ (fpart Yend) Xgap 1.0)) 315 | (setq 316 | Intery (+ Yend Grad) 317 | Xend (iround X2) 318 | Yend (+ Y2 (*/ Grad (- Xend X2) 1.0)) 319 | Xgap (fpart (+ X2 0.5)) 320 | Xpxl2 Xend 321 | Ypxl2 (ipart Yend) ) 322 | (plot Img Xpxl2 Ypxl2 (*/ (rfpart Yend) Xgap 1.0)) 323 | (plot Img Xpxl2 (+ 1.0 Ypxl2) (*/ (fpart Yend) Xgap 1.0)) 324 | (for (X (+ Xpxl1 1.0) (>= (- Xpxl2 1.0) X) (+ X 1.0)) 325 | (plot Img X (ipart Intery) (rfpart Intery)) 326 | (plot Img X (+ 1.0 (ipart Intery)) (fpart Intery)) 327 | (inc 'Intery Grad) ) ) ) ) 328 | 329 | (let Img (make (do 90 (link (need 120 99)))) # Create image 120 x 90 330 | (xiaolin Img 10.0 10.0 110.0 80.0) # Draw lines 331 | (xiaolin Img 10.0 10.0 110.0 45.0) 332 | (xiaolin Img 10.0 80.0 110.0 45.0) 333 | (xiaolin Img 10.0 80.0 110.0 10.0) 334 | (out "img.pgm" # Write to bitmap file 335 | (prinl "P2") 336 | (prinl 120 " " 90) 337 | (prinl 100) 338 | (for Y Img (apply printsp Y)) ) ) 339 | 340 | \end{wideverbatim} 341 | 342 | 343 | 344 | % \input{referenc} 345 | -------------------------------------------------------------------------------- /mainmatter/rosettacode-Y.tex: -------------------------------------------------------------------------------- 1 | %%%%%%%%%%%%%%%%%%%%% chapter.tex %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2 | % 3 | % sample chapter 4 | % 5 | % Use this file as a template for your own input. 6 | % 7 | %%%%%%%%%%%%%%%%%%%%%%%% Springer-Verlag %%%%%%%%%%%%%%%%%%%%%%%%%% 8 | %\motto{Use the template \emph{chapter.tex} to style the various elements of your chapter content.} 9 | 10 | \chapter{Rosetta Code Tasks starting with Y} 11 | 12 | \section*{Y combinator} 13 | 14 | In strict 15 | \href{http://en.wikipedia.org/wiki/Functional\_programming}{functional 16 | programming} and the 17 | \href{http://en.wikipedia.org/wiki/lambda\_calculus}{lambda calculus}, 18 | functions (lambda expressions) don't have state and are only allowed 19 | to refer to arguments of enclosing functions. This rules out the usual 20 | definition of a recursive function wherein a function is associated 21 | with the state of a variable and this variable's state is used in the 22 | body of the function. 23 | 24 | The \href{http://mvanier.livejournal.com/2897.html}{Y combinator} is 25 | itself a stateless function that, when applied to another stateless 26 | function, returns a recursive version of the function. The Y combinator 27 | is the simplest of the class of such functions, called 28 | \href{http://en.wikipedia.org/wiki/Fixed-point\_combinator}{fixed-point 29 | combinators}. 30 | 31 | The task is to define the stateless Y combinator and use it to compute 32 | \href{http://en.wikipedia.org/wiki/Factorial}{factorials} and 33 | \href{http://en.wikipedia.org/wiki/Fibonacci\_number}{Fibonacci numbers} 34 | from other stateless functions or lambda expressions. 35 | 36 | \begin{description} 37 | \item[Cf] 38 | \end{description} 39 | 40 | \begin{itemize} 41 | \item 42 | \href{http://vimeo.com/45140590}{Jim Weirich: Adventures in Functional 43 | Programming} 44 | \end{itemize} 45 | 46 | 47 | 48 | \begin{wideverbatim} 49 | 50 | (de Y (F) 51 | (let X (curry (F) (Y) (F (curry (Y) @ (pass (Y Y))))) 52 | (X X) ) ) 53 | 54 | # Factorial 55 | (de fact (F) 56 | (curry (F) (N) 57 | (if (=0 N) 58 | 1 59 | (* N (F (dec N))) ) ) ) 60 | 61 | : ((Y fact) 6) 62 | -> 720 63 | 64 | # Fibonacci 65 | (de fibo (F) 66 | (curry (F) (N) 67 | (if (> 2 N) 68 | 1 69 | (+ (F (dec N)) (F (- N 2))) ) ) ) 70 | 71 | : ((Y fibo) 22) 72 | -> 28657 73 | 74 | # Ackermann 75 | (de ack (F) 76 | (curry (F) (X Y) 77 | (cond 78 | ((=0 X) (inc Y)) 79 | ((=0 Y) (F (dec X) 1)) 80 | (T (F (dec X) (F X (dec Y)))) ) ) ) 81 | 82 | : ((Y ack) 3 4) 83 | -> 125 84 | 85 | \end{wideverbatim} 86 | 87 | \pagebreak{} 88 | \section*{Yahoo! Search} 89 | 90 | Create a class for searching Yahoo! results. It must implement a 91 | \textbf{Next Page} method, and read URL, Title and Content from results. 92 | 93 | \begin{wideverbatim} 94 | 95 | (load "@lib/http.l") 96 | 97 | (de yahoo (Query Page) 98 | (default Page 1) 99 | (client "search.yahoo.com" 80 100 | (pack 101 | "search?p=" (ht:Fmt Query) 102 | "\&b=" (inc (* 10 (dec Page))) ) 103 | (make 104 | (while (from "") 109 | (link (till "<" T)) # Title 110 | (from "class=\"abstr\"") 111 | (from ">") 112 | (link # Content 113 | (pack 114 | (make 115 | (loop 116 | (link (till "<" T)) 117 | (T (eof)) 118 | (T (= "" T))) 119 | (char) ) ) ) ) ) ) ) ) ) ) 120 | 121 | Output: 122 | 123 | : (more (yahoo "test")) 124 | ("http://www.test.com/" "Test" "Offers practice online tests for many ... 125 | ("http://www.test.com/aboutus.htm" "Test" "Test.com has a successful ... 126 | ("http://en.wikipedia.org/wiki/Test" "Test" "YUI Test is a testing ... 127 | ("http://en.wikipedia.org/wiki/F-test" "test " "test n. A procedure for ... 128 | ... 129 | 130 | \end{wideverbatim} 131 | 132 | \pagebreak{} 133 | \section*{Yin and yang} 134 | 135 | Create a function that given a variable representing size, generates a 136 | \href{http://en.wikipedia.org/wiki/File:Yin\_and\_Yang.svg}{Yin and 137 | yang} also known as a 138 | \href{http://en.wikipedia.org/wiki/Taijitu}{Taijitu} symbol scaled to 139 | that size. 140 | 141 | Generate and display the symbol generated for two different (small) 142 | sizes. 143 | 144 | 145 | \begin{wideverbatim} 146 | 147 | (de circle (X Y C R) 148 | (>= 149 | (* R R) 150 | (+ 151 | (* (setq X (/ X 2)) X) 152 | (* (dec 'Y C) Y) ) ) ) 153 | 154 | (de yinYang (R) 155 | (for Y (range (- R) R) 156 | (for X (range (- 0 R R) (+ R R)) 157 | (prin 158 | (cond 159 | ((circle X Y (- (/ R 2)) (/ R 6)) 160 | "#" ) 161 | ((circle X Y (/ R 2) (/ R 6)) 162 | "." ) 163 | ((circle X Y (- (/ R 2)) (/ R 2)) 164 | "." ) 165 | ((circle X Y (/ R 2) (/ R 2)) 166 | "#" ) 167 | ((circle X Y 0 R) 168 | (if (lt0 X) "." "#") ) 169 | (T " ") ) ) ) 170 | (prinl) ) ) 171 | 172 | \end{wideverbatim} 173 | 174 | \begin{wideverbatim} 175 | 176 | 177 | Test: 178 | 179 | : (yinYang 18) 180 | ... 181 | .....................## 182 | .............................###### 183 | .................................###### 184 | .......................................######## 185 | ...........................................######## 186 | ..........................###................########## 187 | ........................###########............############ 188 | ........................###########............############ 189 | ........................###############............############ 190 | ............................###########............################ 191 | ............................###########............################ 192 | ................................###................################ 193 | .....................................................################## 194 | ...................................................#################### 195 | .................................................###################### 196 | ...............................................######################## 197 | .............................................########################## 198 | ......................................################################### 199 | ..........................############################################# 200 | ........................############################################### 201 | ......................################################################# 202 | ....................################################################### 203 | ..................##################################################### 204 | ................################...################################ 205 | ................############...........############################ 206 | ................############...........############################ 207 | ............############...............######################## 208 | ............############...........######################## 209 | ............############...........######################## 210 | ..........################...########################## 211 | ........########################################### 212 | ........####################################### 213 | ......################################# 214 | ......############################# 215 | ..##################### 216 | ### 217 | 218 | \end{wideverbatim} 219 | 220 | 221 | 222 | % \input{referenc} 223 | -------------------------------------------------------------------------------- /mainmatter/rosettacode-Z.tex: -------------------------------------------------------------------------------- 1 | %%%%%%%%%%%%%%%%%%%%% chapter.tex %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2 | % 3 | % sample chapter 4 | % 5 | % Use this file as a template for your own input. 6 | % 7 | %%%%%%%%%%%%%%%%%%%%%%%% Springer-Verlag %%%%%%%%%%%%%%%%%%%%%%%%%% 8 | %\motto{Use the template \emph{chapter.tex} to style the various elements of your chapter content.} 9 | 10 | \chapter{Rosetta Code Tasks starting with Z} 11 | 12 | \section*{Zebra puzzle} 13 | 14 | The \href{http://en.wikipedia.org/wiki/Zebra\_puzzle}{Zebra puzzle}, 15 | a.k.a. Einstein's Riddle, is a logic puzzle which is to be solved 16 | programmatically. It has several variants, one of them this: 17 | 18 | \begin{enumerate} 19 | \item 20 | There are five houses. 21 | \item 22 | The English man lives in the red house. 23 | \item 24 | The Swede has a dog. 25 | \item 26 | The Dane drinks tea. 27 | \item 28 | The green house is immediately to the left of the white house. 29 | \item 30 | They drink coffee in the green house. 31 | \item 32 | The man who smokes Pall Mall has birds. 33 | \item 34 | In the yellow house they smoke Dunhill. 35 | \item 36 | In the middle house they drink milk. 37 | \item 38 | The Norwegian lives in the first house. 39 | \item 40 | The man who smokes Blend lives in the house next to the house with 41 | cats. 42 | \item 43 | In a house next to the house where they have a horse, they smoke 44 | Dunhill. 45 | \item 46 | The man who smokes Blue Master drinks beer. 47 | \item 48 | The German smokes Prince. 49 | \item 50 | The Norwegian lives next to the blue house. 51 | \item 52 | They drink water in a house next to the house where they smoke Blend. 53 | \end{enumerate} 54 | 55 | The question is, who owns the zebra? 56 | 57 | Additionally, list the solution for all the houses. Optionally, show the 58 | solution is unique. 59 | 60 | cf. \emph{Dinesman's multiple-dwelling problem} 61 | 62 | 63 | 64 | \begin{wideverbatim} 65 | 66 | (be match (@House @Person @Drink @Pet @Cigarettes) 67 | (permute (red blue green yellow white) @House) 68 | (left-of @House white @House green) 69 | 70 | (permute (Norwegian English Swede German Dane) @Person) 71 | (has @Person English @House red) 72 | (equal @Person (Norwegian . @)) 73 | (next-to @Person Norwegian @House blue) 74 | 75 | (permute (tea coffee milk beer water) @Drink) 76 | (has @Drink tea @Person Dane) 77 | (has @Drink coffee @House green) 78 | (equal @Drink (@ @ milk . @)) 79 | 80 | (permute (dog birds cats horse zebra) @Pet) 81 | (has @Pet dog @Person Swede) 82 | 83 | (permute (Pall-Mall Dunhill Blend Blue-Master Prince) @Cigarettes) 84 | (has @Cigarettes Pall-Mall @Pet birds) 85 | (has @Cigarettes Dunhill @House yellow) 86 | (next-to @Cigarettes Blend @Pet cats) 87 | (next-to @Cigarettes Dunhill @Pet horse) 88 | (has @Cigarettes Blue-Master @Drink beer) 89 | (has @Cigarettes Prince @Person German) 90 | 91 | (next-to @Drink water @Cigarettes Blend) ) 92 | 93 | \end{wideverbatim} 94 | 95 | \begin{wideverbatim} 96 | 97 | 98 | (be has ((@A . @X) @A (@B . @Y) @B)) 99 | (be has ((@ . @X) @A (@ . @Y) @B) 100 | (has @X @A @Y @B) ) 101 | 102 | (be right-of ((@A . @X) @A (@ @B . @Y) @B)) 103 | (be right-of ((@ . @X) @A (@ . @Y) @B) 104 | (right-of @X @A @Y @B) ) 105 | 106 | (be left-of ((@ @A . @X) @A (@B . @Y) @B)) 107 | (be left-of ((@ . @X) @A (@ . @Y) @B) 108 | (left-of @X @A @Y @B) ) 109 | 110 | (be next-to (@X @A @Y @B) (right-of @X @A @Y @B)) 111 | (be next-to (@X @A @Y @B) (left-of @X @A @Y @B)) 112 | 113 | Test: 114 | 115 | (pilog '((match @House @Person @Drink @Pet @Cigarettes)) 116 | (let Fmt (-8 -11 -8 -7 -11) 117 | (tab Fmt "HOUSE" "PERSON" "DRINKS" "HAS" "SMOKES") 118 | (mapc '(@ (pass tab Fmt)) 119 | @House @Person @Drink @Pet @Cigarettes ) ) ) 120 | 121 | Output: 122 | 123 | HOUSE PERSON DRINKS HAS SMOKES 124 | yellow Norwegian water cats Dunhill 125 | blue Dane tea horse Blend 126 | red English milk birds Pall-Mall 127 | green German coffee zebra Prince 128 | white Swede beer dog Blue-Master 129 | 130 | \end{wideverbatim} 131 | 132 | \pagebreak{} 133 | \section*{Zig-zag matrix} 134 | 135 | 136 | Produce a zig-zag array. A zig-zag array is a square arrangement of the 137 | first \texttt{N2} integers, where the numbers increase sequentially as 138 | you zig-zag along the anti-diagonals of the array. For a graphical 139 | representation, see 140 | \href{http://en.wikipedia.org/wiki/Image:JPEG\_ZigZag.svg}{JPG zigzag} 141 | (JPG uses such arrays to encode images). 142 | 143 | For example, given \texttt{5}, produce this array: 144 | 145 | \begin{verbatim} 146 | 0 1 5 6 14 147 | 2 4 7 13 15 148 | 3 8 12 16 21 149 | 9 11 17 20 22 150 | 10 18 19 23 24 151 | \end{verbatim} 152 | 153 | 154 | \begin{wideverbatim} 155 | 156 | This example uses 'grid' from "lib/simul.l", which maintains a two-dimensional 157 | structure and is normally used for simulations and board games. 158 | 159 | (load "@lib/simul.l") 160 | 161 | (de zigzag (N) 162 | (prog1 (grid N N) 163 | (let (D '(north west south east .) E '(north east .) This 'a1) 164 | (for Val (* N N) 165 | (=: val Val) 166 | (setq This 167 | (or 168 | ((cadr D) ((car D) This)) 169 | (prog 170 | (setq D (cddr D)) 171 | ((pop 'E) This) ) 172 | ((pop 'E) This) ) ) ) ) ) ) 173 | 174 | (mapc 175 | '((L) 176 | (for This L (prin (align 3 (: val)))) 177 | (prinl) ) 178 | (zigzag 5) ) 179 | 180 | Output: 181 | 182 | 1 2 6 7 15 183 | 3 5 8 14 16 184 | 4 9 13 17 22 185 | 10 12 18 21 23 186 | 11 19 20 24 25 187 | 188 | 189 | \end{wideverbatim} 190 | 191 | 192 | % \input{referenc} 193 | -------------------------------------------------------------------------------- /mainmatter/rosettacode-numbers.tex: -------------------------------------------------------------------------------- 1 | 2 | %%%%%%%%%%%%%%%%%%%%% chapter.tex %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 3 | % 4 | % sample chapter 5 | % 6 | % Use this file as a template for your own input. 7 | % 8 | %%%%%%%%%%%%%%%%%%%%%%%% Springer-Verlag %%%%%%%%%%%%%%%%%%%%%%%%%% 9 | %\motto{Use the template \emph{chapter.tex} to style the various elements of your chapter content.} 10 | 11 | \chapter{Rosetta Code Tasks starting with Numbers} 12 | \label{rosettacode-numbers} 13 | 14 | \section*{100 doors} 15 | 16 | Problem: You have 100 doors in a row that are all initially closed. 17 | You make 100 passes by the doors. The first time through, you visit 18 | every door and toggle the door (if the door is closed, you open it; if 19 | it is open, you close it). The second time you only visit every 2nd 20 | door (door \#2, \#4, \#6, \ldots{}). The third time, every 3rd door 21 | (door \#3, \#6, \#9, \ldots{}), etc, until you only visit the 100th 22 | door. 23 | 24 | Question: What state are the doors in after the last pass? Which are 25 | open, which are closed? 26 | 27 | \textbf{Alternate:} As noted in this page's discussion page, the only 28 | doors that remain open are whose numbers are perfect squares of 29 | integers. Opening only those doors is an optimization that may also be 30 | expressed. 31 | 32 | \begin{wideverbatim} 33 | unoptimized 34 | 35 | (let Doors (need 100) 36 | (for I 100 37 | (for (D (nth Doors I) D (cdr (nth D I))) 38 | (set D (not (car D))) ) ) 39 | (println Doors) ) 40 | 41 | optimized 42 | 43 | (let Doors (need 100) 44 | (for I (sqrt 100) 45 | (set (nth Doors (* I I)) T) ) 46 | (println Doors) ) 47 | \end{wideverbatim} 48 | 49 | \pagebreak{} 50 | \section*{24 game} 51 | 52 | The 24 Game tests one's mental arithmetic. 53 | 54 | Write a program that randomly chooses and displays four digits, each 55 | from one to nine, with repetitions allowed. The program should prompt 56 | for the player to enter an equation using \emph{just} those, and 57 | \emph{all} of those four digits. The program should \emph{check} then 58 | evaluate the expression. The goal is for the player to enter an 59 | expression that evaluates to \textbf{24}. 60 | 61 | \begin{itemize} 62 | \item 63 | Only multiplication, division, addition, and subtraction 64 | operators/functions are allowed. 65 | \item 66 | Division should use floating point or rational arithmetic, etc, to 67 | preserve remainders. 68 | \item 69 | Brackets are allowed, if using an infix expression evaluator. 70 | \item 71 | Forming multiple digit numbers from the supplied digits is 72 | \emph{disallowed}. (So an answer of 12+12 when given 1, 2, 2, and 1 is 73 | wrong). 74 | \item 75 | The order of the digits when given does not have to be preserved. 76 | \end{itemize} 77 | 78 | Note: 79 | 80 | \begin{itemize} 81 | \item The type of expression evaluator used is not mandated. An RPN 82 | evaluator is equally acceptable for example. 83 | \item 84 | The task is not for the program to generate the expression, or test 85 | whether an expression is even possible. 86 | \end{itemize} 87 | 88 | C.f: 24 game Player 89 | 90 | \textbf{Reference} 91 | 92 | \begin{enumerate} 93 | \item 94 | \href{http://www.bbc.co.uk/dna/h2g2/A933121}{The 24 Game} on h2g2. 95 | \end{enumerate} 96 | 97 | 98 | \begin{wideverbatim} 99 | 100 | (de checkExpression (Lst Exe) 101 | (make 102 | (when (diff Lst (fish num? Exe)) 103 | (link "Not all numbers used" ) ) 104 | (when (diff (fish num? Exe) Lst) 105 | (link "Using wrong number(s)") ) 106 | (when (diff (fish sym? Exe) '(+ - * /)) 107 | (link "Using illegal operator(s)") ) ) ) 108 | 109 | (loop 110 | (setq Numbers (make (do 4 (link (rand 1 9))))) 111 | (prinl 112 | "Please enter a Lisp expression using (, ), +, -, *, / and " 113 | (glue ", " Numbers) ) 114 | (prin "Or a single dot '.' to stop: ") 115 | (T (= "." (setq Reply (catch '(NIL) (in NIL (read))))) 116 | (bye) ) 117 | (cond 118 | ((str? Reply) 119 | (prinl "-- Input error: " Reply) ) 120 | ((checkExpression Numbers Reply) 121 | (prinl "-- Illegal Expression") 122 | (for S @ 123 | (space 3) 124 | (prinl S) ) ) 125 | ((str? (setq Result (catch '(NIL) (eval Reply)))) 126 | (prinl "-- Evaluation error: " @) ) 127 | ((= 24 Result) 128 | (prinl "++ Congratulations! Correct result :-)") ) 129 | (T (prinl "Sorry, this gives " Result)) ) 130 | (prinl) ) 131 | 132 | \end{wideverbatim} 133 | 134 | \begin{wideverbatim} 135 | 136 | Output: 137 | 138 | Please enter a Lisp expression using (, ), +, -, *, / and 1, 3, 3, 5 139 | Or a single dot '.' to stop: (* (+ 3 1) (+ 5 1)) 140 | ++ Congratulations! Correct result :-) 141 | 142 | Please enter a Lisp expression using (, ), +, -, *, / and 8, 4, 7, 1 143 | Or a single dot '.' to stop: (* 8 (\% 7 3) 9) 144 | -- Illegal Expression 145 | Not all numbers used 146 | Using wrong number(s) 147 | Using illegal operator(s) 148 | 149 | Please enter a Lisp expression using (, ), +, -, *, / and 4, 2, 2, 3 150 | Or a single dot '.' to stop: (/ (+ 4 3) (- 2 2)) 151 | -- Evaluation error: Div/0 152 | 153 | Please enter a Lisp expression using (, ), +, -, *, / and 8, 4, 5, 9 154 | Or a single dot '.' to stop: . 155 | 156 | \end{wideverbatim} 157 | 158 | \pagebreak{} 159 | \section*{24 game/Solve} 160 | 161 | 162 | Write a function that given four digits subject to the rules of the 163 | 24 game, computes an expression to solve the game 164 | if possible. 165 | 166 | Show examples of solutions generated by the function 167 | 168 | C.F: Arithmetic Evaluator 169 | 170 | 171 | \begin{wideverbatim} 172 | 173 | We use Pilog (PicoLisp Prolog) to solve this task 174 | 175 | (be play24 (@Lst @Expr) # Define Pilog rule 176 | (permute @Lst (@A @B @C @D)) 177 | (member @Op1 (+ - * /)) 178 | (member @Op2 (+ - * /)) 179 | (member @Op3 (+ - * /)) 180 | (or 181 | ((equal @Expr (@Op1 (@Op2 @A @B) (@Op3 @C @D)))) 182 | ((equal @Expr (@Op1 @A (@Op2 @B (@Op3 @C @D))))) ) 183 | (@ = 24 (catch '("Div/0") (eval (-> @Expr)))) ) 184 | 185 | (de play24 (A B C D) # Define PicoLisp function 186 | (pilog 187 | (quote 188 | @L (list A B C D) 189 | (play24 @L @X) ) 190 | (println @X) ) ) 191 | 192 | (play24 5 6 7 8) # Call 'play24' function 193 | 194 | Output: 195 | 196 | (* (+ 5 7) (- 8 6)) 197 | (* 6 (+ 5 (- 7 8))) 198 | (* 6 (- 5 (- 8 7))) 199 | (* 6 (- 5 (/ 8 7))) 200 | (* 6 (+ 7 (- 5 8))) 201 | (* 6 (- 7 (- 8 5))) 202 | (* 6 (/ 8 (- 7 5))) 203 | (/ (* 6 8) (- 7 5)) 204 | (* (+ 7 5) (- 8 6)) 205 | (* (- 8 6) (+ 5 7)) 206 | (* (- 8 6) (+ 7 5)) 207 | (* 8 (/ 6 (- 7 5))) 208 | (/ (* 8 6) (- 7 5)) 209 | 210 | \end{wideverbatim} 211 | 212 | \pagebreak{} 213 | \section*{99 Bottles of Beer} 214 | 215 | 216 | In this puzzle, write code to print out the entire ``99 bottles of beer 217 | on the wall'' song. For those who do not know the song, the lyrics 218 | follow this form: 219 | 220 | \begin{verbatim} 221 | X bottles of beer on the wall 222 | X bottles of beer 223 | Take one down, pass it around 224 | X-1 bottles of beer on the wall 225 | 226 | X-1 bottles of beer on the wall 227 | ... 228 | Take one down, pass it around 229 | 0 bottles of beer on the wall 230 | \end{verbatim} 231 | 232 | Where X and X-1 are replaced by numbers of course. Grammatical support 233 | for ``1 bottle of beer'' is optional. As with any puzzle, try to do it 234 | in as creative/concise/comical a way as possible (simple, obvious 235 | solutions allowed, too). 236 | 237 | See also: 238 | \href{http://99-bottles-of-beer.net/}{http://99-bottles-of-beer.net/} 239 | 240 | 241 | \begin{wideverbatim} 242 | 243 | (de bottles (N) 244 | (case N 245 | (0 "No more beer") 246 | (1 "One bottle of beer") 247 | (T (cons N " bottles of beer")) ) ) 248 | 249 | (for (N 99 (gt0 N)) 250 | (prinl (bottles N) " on the wall,") 251 | (prinl (bottles N) ".") 252 | (prinl "Take one down, pass it around,") 253 | (prinl (bottles (dec 'N)) " on the wall.") 254 | (prinl) ) 255 | 256 | \end{wideverbatim} 257 | 258 | 259 | 260 | 261 | % \input{referenc} 262 | -------------------------------------------------------------------------------- /svmono.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tj64/picolisp-by-example/6112c3fd07b778ce7ea0422bcf2484af0ae4f476/svmono.zip --------------------------------------------------------------------------------