carats 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (422) hide show
  1. data/ChangeLog +2 -0
  2. data/LICENSE +5 -0
  3. data/README +67 -0
  4. data/Reapfile +72 -0
  5. data/ToDo +24 -0
  6. data/bench/b_harray.rb +49 -0
  7. data/bench/b_range.rb +64 -0
  8. data/demo/ansicolor/cdiff.rb +20 -0
  9. data/demo/ansicolor/example.rb +82 -0
  10. data/demo/io-reactor/chatserver.rb +347 -0
  11. data/doc/classes/Array.html +172 -0
  12. data/doc/classes/BBCode.html +638 -0
  13. data/doc/classes/BinaryReader.html +675 -0
  14. data/doc/classes/Binding.html +223 -0
  15. data/doc/classes/ByteOrder.html +284 -0
  16. data/doc/classes/Class.html +189 -0
  17. data/doc/classes/Constant.html +785 -0
  18. data/doc/classes/Constant/CGS.html +609 -0
  19. data/doc/classes/Continuation.html +113 -0
  20. data/doc/classes/Coroutine.html +387 -0
  21. data/doc/classes/CountingSemaphore.html +337 -0
  22. data/doc/classes/CrossCase.html +561 -0
  23. data/doc/classes/DynamicMixin.html +185 -0
  24. data/doc/classes/EnumerableWithArgs.html +550 -0
  25. data/doc/classes/Expect.html +428 -0
  26. data/doc/classes/Expect/DefaultChain.html +113 -0
  27. data/doc/classes/Expect/SeparatedPattern.html +223 -0
  28. data/doc/classes/Expect/Timeout.html +167 -0
  29. data/doc/classes/Expect/UnmatchedMessage.html +160 -0
  30. data/doc/classes/FileList.html +833 -0
  31. data/doc/classes/FloatString.html +534 -0
  32. data/doc/classes/Functor.html +211 -0
  33. data/doc/classes/HArray.html +1872 -0
  34. data/doc/classes/HTML.html +328 -0
  35. data/doc/classes/Heap.html +683 -0
  36. data/doc/classes/Heap/EmptyHeapException.html +111 -0
  37. data/doc/classes/Heap/Max.html +176 -0
  38. data/doc/classes/Heap/Min.html +176 -0
  39. data/doc/classes/IO.html +108 -0
  40. data/doc/classes/IO/Reactor.html +790 -0
  41. data/doc/classes/IO/Redirect.html +289 -0
  42. data/doc/classes/Infinity.html +320 -0
  43. data/doc/classes/Interval.html +1014 -0
  44. data/doc/classes/InvalidNackError.html +161 -0
  45. data/doc/classes/Kernel.html +204 -0
  46. data/doc/classes/Lisp.html +1132 -0
  47. data/doc/classes/Lisp/DottedPair.html +379 -0
  48. data/doc/classes/Lisp/Format.html +178 -0
  49. data/doc/classes/Lisp/Format/ArgumentError.html +126 -0
  50. data/doc/classes/Lisp/Format/Directives.html +155 -0
  51. data/doc/classes/Lisp/Format/Directives/ArgJump.html +178 -0
  52. data/doc/classes/Lisp/Format/Directives/Ascii.html +119 -0
  53. data/doc/classes/Lisp/Format/Directives/BeginCaseConversion.html +185 -0
  54. data/doc/classes/Lisp/Format/Directives/BeginConditional.html +307 -0
  55. data/doc/classes/Lisp/Format/Directives/BeginIteration.html +338 -0
  56. data/doc/classes/Lisp/Format/Directives/Binary.html +157 -0
  57. data/doc/classes/Lisp/Format/Directives/Character.html +228 -0
  58. data/doc/classes/Lisp/Format/Directives/CharacterDirective.html +203 -0
  59. data/doc/classes/Lisp/Format/Directives/ClauseSeparator.html +166 -0
  60. data/doc/classes/Lisp/Format/Directives/Decimal.html +119 -0
  61. data/doc/classes/Lisp/Format/Directives/Directive.html +397 -0
  62. data/doc/classes/Lisp/Format/Directives/DollarFP.html +205 -0
  63. data/doc/classes/Lisp/Format/Directives/EndCaseConversion.html +174 -0
  64. data/doc/classes/Lisp/Format/Directives/EndConditional.html +159 -0
  65. data/doc/classes/Lisp/Format/Directives/EndIteration.html +163 -0
  66. data/doc/classes/Lisp/Format/Directives/ExpFP.html +252 -0
  67. data/doc/classes/Lisp/Format/Directives/FFFP.html +224 -0
  68. data/doc/classes/Lisp/Format/Directives/Factory.html +180 -0
  69. data/doc/classes/Lisp/Format/Directives/FreshLine.html +175 -0
  70. data/doc/classes/Lisp/Format/Directives/GeneralFP.html +265 -0
  71. data/doc/classes/Lisp/Format/Directives/Hexadecimal.html +157 -0
  72. data/doc/classes/Lisp/Format/Directives/Indirection.html +183 -0
  73. data/doc/classes/Lisp/Format/Directives/Literal.html +187 -0
  74. data/doc/classes/Lisp/Format/Directives/NewLine.html +158 -0
  75. data/doc/classes/Lisp/Format/Directives/NewPage.html +158 -0
  76. data/doc/classes/Lisp/Format/Directives/Number.html +243 -0
  77. data/doc/classes/Lisp/Format/Directives/Octal.html +157 -0
  78. data/doc/classes/Lisp/Format/Directives/Plural.html +177 -0
  79. data/doc/classes/Lisp/Format/Directives/Print.html +237 -0
  80. data/doc/classes/Lisp/Format/Directives/Radix.html +432 -0
  81. data/doc/classes/Lisp/Format/Directives/SExpression.html +157 -0
  82. data/doc/classes/Lisp/Format/Directives/SkipWhitespace.html +165 -0
  83. data/doc/classes/Lisp/Format/Directives/Tabulate.html +198 -0
  84. data/doc/classes/Lisp/Format/Directives/Tilde.html +158 -0
  85. data/doc/classes/Lisp/Format/Directives/UnknownDirectiveError.html +117 -0
  86. data/doc/classes/Lisp/Format/Formatter.html +193 -0
  87. data/doc/classes/Lisp/Format/IncompleteParameterError.html +119 -0
  88. data/doc/classes/Lisp/Format/IndexError.html +126 -0
  89. data/doc/classes/Lisp/Format/Lexer.html +479 -0
  90. data/doc/classes/Lisp/Format/MalformedError.html +119 -0
  91. data/doc/classes/Lisp/Format/MissingParameterError.html +119 -0
  92. data/doc/classes/Lisp/Format/ModifierError.html +119 -0
  93. data/doc/classes/Lisp/Format/Output.html +239 -0
  94. data/doc/classes/Lisp/Format/ParameterError.html +126 -0
  95. data/doc/classes/Lisp/Format/Parameters.html +123 -0
  96. data/doc/classes/Lisp/Format/Parameters/Argument.html +172 -0
  97. data/doc/classes/Lisp/Format/Parameters/ArgumentCount.html +159 -0
  98. data/doc/classes/Lisp/Format/Parameters/Character.html +119 -0
  99. data/doc/classes/Lisp/Format/Parameters/Default.html +120 -0
  100. data/doc/classes/Lisp/Format/Parameters/Integer.html +119 -0
  101. data/doc/classes/Lisp/Format/Parameters/Parameter.html +206 -0
  102. data/doc/classes/Lisp/Format/Parser.html +212 -0
  103. data/doc/classes/Lisp/Format/Positioned.html +166 -0
  104. data/doc/classes/Lisp/Format/State.html +455 -0
  105. data/doc/classes/Lisp/Format/SyntaxError.html +126 -0
  106. data/doc/classes/Method.html +274 -0
  107. data/doc/classes/Method/DuckHunter.html +281 -0
  108. data/doc/classes/Module.html +709 -0
  109. data/doc/classes/Multiton.html +284 -0
  110. data/doc/classes/Multiton/New.html +164 -0
  111. data/doc/classes/Multiton/Semi.html +155 -0
  112. data/doc/classes/NackClass.html +322 -0
  113. data/doc/classes/NilClass.html +231 -0
  114. data/doc/classes/NilComparable.html +179 -0
  115. data/doc/classes/NotCopyable.html +273 -0
  116. data/doc/classes/Object.html +261 -0
  117. data/doc/classes/OpenStructable.html +346 -0
  118. data/doc/classes/OrderedHash.html +939 -0
  119. data/doc/classes/Parser.html +515 -0
  120. data/doc/classes/Parser/Main.html +178 -0
  121. data/doc/classes/Parser/Marker.html +475 -0
  122. data/doc/classes/Parser/Registry.html +354 -0
  123. data/doc/classes/Parser/Token.html +399 -0
  124. data/doc/classes/Parser/UnitToken.html +222 -0
  125. data/doc/classes/Ref.html +230 -0
  126. data/doc/classes/SimpleStringIO.html +183 -0
  127. data/doc/classes/StaticHash.html +202 -0
  128. data/doc/classes/String.html +172 -0
  129. data/doc/classes/Struct.html +181 -0
  130. data/doc/classes/SuperStruct.html +382 -0
  131. data/doc/classes/Term.html +156 -0
  132. data/doc/classes/Term/ANSIColor.html +185 -0
  133. data/doc/classes/Text.html +138 -0
  134. data/doc/classes/Text/Soundex.html +222 -0
  135. data/doc/classes/TextTagIterator.html +911 -0
  136. data/doc/classes/Time.html +119 -0
  137. data/doc/classes/Time/Limit.html +303 -0
  138. data/doc/classes/Time/Limit/Dummy.html +181 -0
  139. data/doc/classes/Timer.html +351 -0
  140. data/doc/classes/TracePoint.html +532 -0
  141. data/doc/classes/Tuple.html +178 -0
  142. data/doc/classes/Uninheritable.html +213 -0
  143. data/doc/classes/Version.html +783 -0
  144. data/doc/created.rid +1 -0
  145. data/doc/files/LICENSE.html +113 -0
  146. data/doc/files/README.html +201 -0
  147. data/doc/files/lib/carat/1st_rb.html +107 -0
  148. data/doc/files/lib/carat/ansicolor_rb.html +146 -0
  149. data/doc/files/lib/carat/attr_rb.html +101 -0
  150. data/doc/files/lib/carat/bbcode_rb.html +152 -0
  151. data/doc/files/lib/carat/binaryreader_rb.html +114 -0
  152. data/doc/files/lib/carat/binding-of-caller_rb.html +108 -0
  153. data/doc/files/lib/carat/byteorder_rb.html +107 -0
  154. data/doc/files/lib/carat/constant_rb.html +167 -0
  155. data/doc/files/lib/carat/coroutine_rb.html +156 -0
  156. data/doc/files/lib/carat/crosscase_rb.html +224 -0
  157. data/doc/files/lib/carat/duckhunter_rb.html +165 -0
  158. data/doc/files/lib/carat/dynamic-mixin_rb.html +101 -0
  159. data/doc/files/lib/carat/enumerable-args_rb.html +140 -0
  160. data/doc/files/lib/carat/expect_rb.html +137 -0
  161. data/doc/files/lib/carat/filelist_rb.html +130 -0
  162. data/doc/files/lib/carat/floatstring_rb.html +126 -0
  163. data/doc/files/lib/carat/functor_rb.html +140 -0
  164. data/doc/files/lib/carat/harray_rb.html +128 -0
  165. data/doc/files/lib/carat/heap_rb.html +154 -0
  166. data/doc/files/lib/carat/html-helpers_rb.html +116 -0
  167. data/doc/files/lib/carat/infinity_rb.html +142 -0
  168. data/doc/files/lib/carat/init_rb.html +127 -0
  169. data/doc/files/lib/carat/interval_rb.html +162 -0
  170. data/doc/files/lib/carat/io-reactor_rb.html +211 -0
  171. data/doc/files/lib/carat/io-redirect_rb.html +132 -0
  172. data/doc/files/lib/carat/lisp-format_rb.html +187 -0
  173. data/doc/files/lib/carat/lisp_rb.html +152 -0
  174. data/doc/files/lib/carat/macro_rb.html +129 -0
  175. data/doc/files/lib/carat/multiton_rb.html +178 -0
  176. data/doc/files/lib/carat/nack_rb.html +193 -0
  177. data/doc/files/lib/carat/nil-comparable_rb.html +126 -0
  178. data/doc/files/lib/carat/nil-missing_rb.html +101 -0
  179. data/doc/files/lib/carat/notcopyable_rb.html +166 -0
  180. data/doc/files/lib/carat/orderedhash_rb.html +107 -0
  181. data/doc/files/lib/carat/ostructable_rb.html +157 -0
  182. data/doc/files/lib/carat/parser-old_rb.html +239 -0
  183. data/doc/files/lib/carat/parser_rb.html +244 -0
  184. data/doc/files/lib/carat/ref_rb.html +107 -0
  185. data/doc/files/lib/carat/semaphore_rb.html +132 -0
  186. data/doc/files/lib/carat/snapshot_rb.html +152 -0
  187. data/doc/files/lib/carat/soundex_rb.html +128 -0
  188. data/doc/files/lib/carat/sstruct_rb.html +142 -0
  189. data/doc/files/lib/carat/statichash_rb.html +150 -0
  190. data/doc/files/lib/carat/tagiter_rb.html +236 -0
  191. data/doc/files/lib/carat/timelimit_rb.html +136 -0
  192. data/doc/files/lib/carat/timer_rb.html +153 -0
  193. data/doc/files/lib/carat/tracepoint_rb.html +160 -0
  194. data/doc/files/lib/carat/tuple_rb.html +123 -0
  195. data/doc/files/lib/carat/uninheritable_rb.html +101 -0
  196. data/doc/files/lib/carat/version_rb.html +141 -0
  197. data/doc/fr_class_index.html +159 -0
  198. data/doc/fr_file_index.html +78 -0
  199. data/doc/fr_method_index.html +663 -0
  200. data/doc/index.html +24 -0
  201. data/doc/rdoc-style.css +208 -0
  202. data/lib/carat-dev/README +11 -0
  203. data/lib/carat-dev/access-blocks/access_blocks.rb +42 -0
  204. data/lib/carat-dev/association/association.rb +70 -0
  205. data/lib/carat-dev/blankslate/blankslate.rb +51 -0
  206. data/lib/carat-dev/breakpoint.rb +518 -0
  207. data/lib/carat-dev/class-constructor/constructor_methods.rb +78 -0
  208. data/lib/carat-dev/class-constructor/tc_constructor.rb +35 -0
  209. data/lib/carat-dev/closecall/closecall-test.rb +39 -0
  210. data/lib/carat-dev/closecall/closecall.rb +101 -0
  211. data/lib/carat-dev/commandrunner/commandrunner.rb +100 -0
  212. data/lib/carat-dev/conditional/conditionals.rb +106 -0
  213. data/lib/carat-dev/daemon/daemon.rb +70 -0
  214. data/lib/carat-dev/detach/detach.rb +363 -0
  215. data/lib/carat-dev/detach/tc_detach.rb +57 -0
  216. data/lib/carat-dev/import-module/import-module-0.81.tar.gz +0 -0
  217. data/lib/carat-dev/import-module/import-module-0.81/LICENSE +1 -0
  218. data/lib/carat-dev/import-module/import-module-0.81/Makefile +11 -0
  219. data/lib/carat-dev/import-module/import-module-0.81/README +4 -0
  220. data/lib/carat-dev/import-module/import-module-0.81/dev-lib/import-module-hash.rb +49 -0
  221. data/lib/carat-dev/import-module/import-module-0.81/dev-lib/import-module-pip.rb +71 -0
  222. data/lib/carat-dev/import-module/import-module-0.81/dev-lib/import-module-unbound-method.rb +36 -0
  223. data/lib/carat-dev/import-module/import-module-0.81/doc/README-ja.html +293 -0
  224. data/lib/carat-dev/import-module/import-module-0.81/doc/README-ja.rd +306 -0
  225. data/lib/carat-dev/import-module/import-module-0.81/doc/README.html +290 -0
  226. data/lib/carat-dev/import-module/import-module-0.81/doc/README.rd +303 -0
  227. data/lib/carat-dev/import-module/import-module-0.81/doc/style.css +85 -0
  228. data/lib/carat-dev/import-module/import-module-0.81/install.rb +99 -0
  229. data/lib/carat-dev/import-module/import-module-0.81/lib/import-module-single-thread.rb +84 -0
  230. data/lib/carat-dev/import-module/import-module-0.81/lib/import-module.rb +493 -0
  231. data/lib/carat-dev/import-module/import-module-0.81/test/Makefile +2 -0
  232. data/lib/carat-dev/import-module/import-module-0.81/test/test +91 -0
  233. data/lib/carat-dev/import-module/import-module-0.81/test/test-import-module.rb +936 -0
  234. data/lib/carat-dev/import-module/import-module-0.81/test/test-import_scope.rb +33 -0
  235. data/lib/carat-dev/import-module/import-module-0.81/test/test-scope_import.rb +33 -0
  236. data/lib/carat-dev/import-module/import-module-0.81/test/test-time.rb +184 -0
  237. data/lib/carat-dev/import-module/import-module-0.81/test/test.sh +91 -0
  238. data/lib/carat-dev/import-module/import-module-0.81/test/time.rb +135 -0
  239. data/lib/carat-dev/import-module/import-module-0.81/test/times-do.sh +10 -0
  240. data/lib/carat-dev/interface_work/SCRAP/i-contracts.rb +37 -0
  241. data/lib/carat-dev/interface_work/SCRAP/interface.rb +105 -0
  242. data/lib/carat-dev/interface_work/SCRAP/j-interface/interface-0.1.0.zip +0 -0
  243. data/lib/carat-dev/interface_work/SCRAP/j-interface/interface-0.1.0/CHANGES +3 -0
  244. data/lib/carat-dev/interface_work/SCRAP/j-interface/interface-0.1.0/MANIFEST +15 -0
  245. data/lib/carat-dev/interface_work/SCRAP/j-interface/interface-0.1.0/README +32 -0
  246. data/lib/carat-dev/interface_work/SCRAP/j-interface/interface-0.1.0/doc/interface.rd +73 -0
  247. data/lib/carat-dev/interface_work/SCRAP/j-interface/interface-0.1.0/doc/interface.txt +94 -0
  248. data/lib/carat-dev/interface_work/SCRAP/j-interface/interface-0.1.0/install.rb +16 -0
  249. data/lib/carat-dev/interface_work/SCRAP/j-interface/interface-0.1.0/lib/interface.rb +50 -0
  250. data/lib/carat-dev/interface_work/SCRAP/j-interface/interface-0.1.0/test/tc_interface.rb +51 -0
  251. data/lib/carat-dev/interface_work/SCRAP/j-interface/interface-0.1.0/test/test.rb +29 -0
  252. data/lib/carat-dev/interface_work/SCRAP/j-interface/interface-0.1.0/test/test_instance.rb +24 -0
  253. data/lib/carat-dev/interface_work/SCRAP/j-interface/interface-0.1.0/test/test_sub.rb +29 -0
  254. data/lib/carat-dev/interface_work/SCRAP/j-interface/interface-0.1.0/test/test_unrequire.rb +28 -0
  255. data/lib/carat-dev/interface_work/contracts/contract.zip +0 -0
  256. data/lib/carat-dev/interface_work/contracts/contract/doc/classes/Contract.html +376 -0
  257. data/lib/carat-dev/interface_work/contracts/contract/doc/classes/Contract.src/M000001.html +23 -0
  258. data/lib/carat-dev/interface_work/contracts/contract/doc/classes/Contract.src/M000002.html +18 -0
  259. data/lib/carat-dev/interface_work/contracts/contract/doc/classes/Contract.src/M000003.html +19 -0
  260. data/lib/carat-dev/interface_work/contracts/contract/doc/classes/Contract.src/M000004.html +29 -0
  261. data/lib/carat-dev/interface_work/contracts/contract/doc/classes/Contract.src/M000005.html +18 -0
  262. data/lib/carat-dev/interface_work/contracts/contract/doc/classes/Contract.src/M000006.html +18 -0
  263. data/lib/carat-dev/interface_work/contracts/contract/doc/classes/Contract/ContractError.html +142 -0
  264. data/lib/carat-dev/interface_work/contracts/contract/doc/classes/Contract/ContractException.html +153 -0
  265. data/lib/carat-dev/interface_work/contracts/contract/doc/classes/Contract/ContractMismatch.html +125 -0
  266. data/lib/carat-dev/interface_work/contracts/contract/doc/classes/Module.html +157 -0
  267. data/lib/carat-dev/interface_work/contracts/contract/doc/classes/Module.src/M000007.html +112 -0
  268. data/lib/carat-dev/interface_work/contracts/contract/doc/created.rid +1 -0
  269. data/lib/carat-dev/interface_work/contracts/contract/doc/files/lib/contract/assertions_rb.html +109 -0
  270. data/lib/carat-dev/interface_work/contracts/contract/doc/files/lib/contract/exception_rb.html +108 -0
  271. data/lib/carat-dev/interface_work/contracts/contract/doc/files/lib/contract/integration_rb.html +108 -0
  272. data/lib/carat-dev/interface_work/contracts/contract/doc/files/lib/contract/overrides_rb.html +109 -0
  273. data/lib/carat-dev/interface_work/contracts/contract/doc/files/lib/contract_rb.html +114 -0
  274. data/lib/carat-dev/interface_work/contracts/contract/doc/fr_class_index.html +31 -0
  275. data/lib/carat-dev/interface_work/contracts/contract/doc/fr_file_index.html +31 -0
  276. data/lib/carat-dev/interface_work/contracts/contract/doc/fr_method_index.html +33 -0
  277. data/lib/carat-dev/interface_work/contracts/contract/doc/index.html +24 -0
  278. data/lib/carat-dev/interface_work/contracts/contract/doc/rdoc-style.css +208 -0
  279. data/lib/carat-dev/interface_work/contracts/contract/lib/contract.rb +88 -0
  280. data/lib/carat-dev/interface_work/contracts/contract/lib/contract/assertions.rb +37 -0
  281. data/lib/carat-dev/interface_work/contracts/contract/lib/contract/exception.rb +92 -0
  282. data/lib/carat-dev/interface_work/contracts/contract/lib/contract/integration.rb +132 -0
  283. data/lib/carat-dev/interface_work/contracts/contract/lib/contract/overrides.rb +32 -0
  284. data/lib/carat-dev/interface_work/must.rb +37 -0
  285. data/lib/carat-dev/interface_work/type.rb +232 -0
  286. data/lib/carat-dev/main/tc_toplevel.rb +23 -0
  287. data/lib/carat-dev/main/toplevel.rb +33 -0
  288. data/lib/carat-dev/main/toplevel_test.rb +24 -0
  289. data/lib/carat-dev/misc/1.rb +40 -0
  290. data/lib/carat-dev/misc/misc.rb +44 -0
  291. data/lib/carat-dev/misc/sys.rb +186 -0
  292. data/lib/carat-dev/misc/temp.rb +1 -0
  293. data/lib/carat-dev/misc/utils.rb +518 -0
  294. data/lib/carat-dev/predicate/predicate.rb +109 -0
  295. data/lib/carat-dev/predicate/predicate_test.rb +67 -0
  296. data/lib/carat-dev/premshree.rb +40 -0
  297. data/lib/carat-dev/priority-queue/pqueue.rb +183 -0
  298. data/lib/carat-dev/priority-queue/priorityqueue.rb +84 -0
  299. data/lib/carat-dev/quaternion/quaternion.rb +529 -0
  300. data/lib/carat-dev/range.rb +259 -0
  301. data/lib/carat-dev/system/rubyinfo.rb +75 -0
  302. data/lib/carat-dev/system/system.rb +105 -0
  303. data/lib/carat-dev/tc_range.rb +118 -0
  304. data/lib/carat-dev/timer/timer-doc/classes/Timer.html +291 -0
  305. data/lib/carat-dev/timer/timer-doc/classes/Timer.src/M000001.html +26 -0
  306. data/lib/carat-dev/timer/timer-doc/classes/Timer.src/M000002.html +19 -0
  307. data/lib/carat-dev/timer/timer-doc/classes/Timer.src/M000003.html +18 -0
  308. data/lib/carat-dev/timer/timer-doc/classes/Timer.src/M000004.html +18 -0
  309. data/lib/carat-dev/timer/timer-doc/classes/Timer.src/M000005.html +21 -0
  310. data/lib/carat-dev/timer/timer-doc/classes/Timer.src/M000006.html +23 -0
  311. data/lib/carat-dev/timer/timer-doc/created.rid +1 -0
  312. data/lib/carat-dev/timer/timer-doc/files/timer_rb.html +144 -0
  313. data/lib/carat-dev/timer/timer-doc/fr_class_index.html +27 -0
  314. data/lib/carat-dev/timer/timer-doc/fr_file_index.html +27 -0
  315. data/lib/carat-dev/timer/timer-doc/fr_method_index.html +32 -0
  316. data/lib/carat-dev/timer/timer-doc/index.html +24 -0
  317. data/lib/carat-dev/timer/timer-doc/rdoc-style.css +208 -0
  318. data/lib/carat-dev/timer/timer.rb +160 -0
  319. data/lib/carat-dev/vars/vars.rb +62 -0
  320. data/lib/carat/1st.rb +58 -0
  321. data/lib/carat/ansicolor.rb +122 -0
  322. data/lib/carat/attr.rb +342 -0
  323. data/lib/carat/bbcode.rb +352 -0
  324. data/lib/carat/binaryreader.rb +170 -0
  325. data/lib/carat/binding-of-caller.rb +83 -0
  326. data/lib/carat/byteorder.rb +34 -0
  327. data/lib/carat/constant.rb +287 -0
  328. data/lib/carat/coroutine.rb +102 -0
  329. data/lib/carat/crosscase.rb +309 -0
  330. data/lib/carat/duckhunter.rb +158 -0
  331. data/lib/carat/dynamic-mixin.rb +71 -0
  332. data/lib/carat/enumerable-args.rb +125 -0
  333. data/lib/carat/expect.rb +192 -0
  334. data/lib/carat/filelist.rb +277 -0
  335. data/lib/carat/floatstring.rb +153 -0
  336. data/lib/carat/functor.rb +41 -0
  337. data/lib/carat/harray.rb +507 -0
  338. data/lib/carat/heap.rb +193 -0
  339. data/lib/carat/html-helpers.rb +82 -0
  340. data/lib/carat/infinity.rb +61 -0
  341. data/lib/carat/init.rb +33 -0
  342. data/lib/carat/interval.rb +248 -0
  343. data/lib/carat/io-reactor.rb +657 -0
  344. data/lib/carat/io-redirect.rb +99 -0
  345. data/lib/carat/lisp-format.rb +1832 -0
  346. data/lib/carat/lisp.rb +336 -0
  347. data/lib/carat/macro.rb +68 -0
  348. data/lib/carat/multiton.rb +153 -0
  349. data/lib/carat/nack.rb +115 -0
  350. data/lib/carat/nil-comparable.rb +67 -0
  351. data/lib/carat/nil-missing.rb +12 -0
  352. data/lib/carat/notcopyable.rb +68 -0
  353. data/lib/carat/orderedhash.rb +249 -0
  354. data/lib/carat/ostructable.rb +138 -0
  355. data/lib/carat/parser-old.rb +350 -0
  356. data/lib/carat/parser.rb +393 -0
  357. data/lib/carat/ref.rb +31 -0
  358. data/lib/carat/semaphore.rb +69 -0
  359. data/lib/carat/snapshot.rb +94 -0
  360. data/lib/carat/soundex.rb +104 -0
  361. data/lib/carat/sstruct.rb +223 -0
  362. data/lib/carat/statichash.rb +49 -0
  363. data/lib/carat/tagiter.rb +345 -0
  364. data/lib/carat/timelimit.rb +114 -0
  365. data/lib/carat/timer.rb +99 -0
  366. data/lib/carat/tracepoint.rb +154 -0
  367. data/lib/carat/tuple.rb +31 -0
  368. data/lib/carat/uninheritable.rb +68 -0
  369. data/lib/carat/version.rb +147 -0
  370. data/pub/doc/sstruct.txt +204 -0
  371. data/pub/doc/tagiter.html +145 -0
  372. data/setup.rb +1361 -0
  373. data/test/fixtures/filelist/testfile.txt +1 -0
  374. data/test/fixtures/filelist/testfile2.txt +1 -0
  375. data/test/tc_1st.rb +16 -0
  376. data/test/tc_ansicolor.rb +23 -0
  377. data/test/tc_attr.rb +46 -0
  378. data/test/tc_bbcode.rb +20 -0
  379. data/test/tc_binaryreader.rb +14 -0
  380. data/test/tc_binding_of_caller.rb +2 -0
  381. data/test/tc_byteorder.rb +41 -0
  382. data/test/tc_constant.rb +12 -0
  383. data/test/tc_coroutine.rb +50 -0
  384. data/test/tc_crosscase.rb +33 -0
  385. data/test/tc_duckhunter.rb +37 -0
  386. data/test/tc_dynamic-mixin.rb +66 -0
  387. data/test/tc_enumerable-args.rb +66 -0
  388. data/test/tc_expect.rb +83 -0
  389. data/test/tc_filelist.rb +17 -0
  390. data/test/tc_floatstring.rb +22 -0
  391. data/test/tc_functor.rb +18 -0
  392. data/test/tc_harray.rb +280 -0
  393. data/test/tc_heap.rb +6 -0
  394. data/test/tc_infinity.rb +23 -0
  395. data/test/tc_init.rb +29 -0
  396. data/test/tc_interval.rb +153 -0
  397. data/test/tc_io-reactor.rb +5 -0
  398. data/test/tc_io-redirect.rb +5 -0
  399. data/test/tc_lisp-format.rb +24 -0
  400. data/test/tc_lisp.rb +32 -0
  401. data/test/tc_macro.rb +48 -0
  402. data/test/tc_multiton.rb +188 -0
  403. data/test/tc_nack.rb +31 -0
  404. data/test/tc_nil-as-emptiness.rb +19 -0
  405. data/test/tc_nil-comparable.rb +29 -0
  406. data/test/tc_nil-missing.rb +0 -0
  407. data/test/tc_notcopyable.rb +64 -0
  408. data/test/tc_orderedhash.rb +36 -0
  409. data/test/tc_ostructable.rb +31 -0
  410. data/test/tc_semaphore.rb +5 -0
  411. data/test/tc_snapshot.rb +20 -0
  412. data/test/tc_soundex.rb +19 -0
  413. data/test/tc_sstruct.rb +313 -0
  414. data/test/tc_statichash.rb +24 -0
  415. data/test/tc_tagiter.rb +80 -0
  416. data/test/tc_timelimit.rb +47 -0
  417. data/test/tc_timer.rb +35 -0
  418. data/test/tc_tracepoint.rb +10 -0
  419. data/test/tc_tuple.rb +25 -0
  420. data/test/tc_uninheritable.rb +33 -0
  421. data/test/tc_version.rb +90 -0
  422. metadata +531 -0
@@ -0,0 +1,161 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
+ <head>
8
+ <title>Class: InvalidNackError</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
11
+ <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
12
+ <script type="text/javascript">
13
+ // <![CDATA[
14
+
15
+ function popupCode( url ) {
16
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
17
+ }
18
+
19
+ function toggleCode( id ) {
20
+ if ( document.getElementById )
21
+ elem = document.getElementById( id );
22
+ else if ( document.all )
23
+ elem = eval( "document.all." + id );
24
+ else
25
+ return false;
26
+
27
+ elemStyle = elem.style;
28
+
29
+ if ( elemStyle.display != "block" ) {
30
+ elemStyle.display = "block"
31
+ } else {
32
+ elemStyle.display = "none"
33
+ }
34
+
35
+ return true;
36
+ }
37
+
38
+ // Make codeblocks hidden by default
39
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
40
+
41
+ // ]]>
42
+ </script>
43
+
44
+ </head>
45
+ <body>
46
+
47
+
48
+
49
+ <div id="classHeader">
50
+ <table class="header-table">
51
+ <tr class="top-aligned-row">
52
+ <td><strong>Class</strong></td>
53
+ <td class="class-name-in-header">InvalidNackError</td>
54
+ </tr>
55
+ <tr class="top-aligned-row">
56
+ <td><strong>In:</strong></td>
57
+ <td>
58
+ <a href="../files/lib/carat/nack_rb.html">
59
+ lib/carat/nack.rb
60
+ </a>
61
+ <br />
62
+ </td>
63
+ </tr>
64
+
65
+ <tr class="top-aligned-row">
66
+ <td><strong>Parent:</strong></td>
67
+ <td>
68
+ ArgumentError
69
+ </td>
70
+ </tr>
71
+ </table>
72
+ </div>
73
+ <!-- banner header -->
74
+
75
+ <div id="bodyContent">
76
+
77
+
78
+
79
+ <div id="contextContent">
80
+
81
+ <div id="description">
82
+ <h1><a href="NackClass.html">NackClass</a></h1>
83
+ <p>
84
+ The <a href="NackClass.html">NackClass</a> is is like the <a
85
+ href="NilClass.html">NilClass</a> except one step down. Nack is never used
86
+ to to mean nothingness or emptiness. The Nack class is only used to report
87
+ something is &quot;a miss&quot; w/o the system raising an Exception.
88
+ It&#8217;s a mechanism for lazy error evaluation.
89
+ </p>
90
+ <h2>Usage</h2>
91
+ <pre>
92
+ def scalar( x )
93
+ if x.kind_of?(Enumerable)
94
+ return nack(ArgumentError, &quot;Value must not be enumerable&quot;)
95
+ end
96
+ x
97
+ end
98
+
99
+ a = scaler( 1 ) #=&gt; 1
100
+ b = scaler( [1,2] ) #=&gt; nack
101
+ b.first #=&gt; ArgumentError (previous)
102
+
103
+ a = nail scaler( 1 ) #=&gt; 1
104
+ b = nail scaler( [1,2] ) #=&gt; ArgumentError
105
+ </pre>
106
+ <h2>TODO</h2>
107
+ <ul>
108
+ <li>I beleive this class has even more potential yet. It would be interesting
109
+ to see if a catch/try correction facility could be built into it too.
110
+
111
+ </li>
112
+ </ul>
113
+ <h2>Author(s)</h2>
114
+ <ul>
115
+ <li>Thomas Sawyer
116
+
117
+ </li>
118
+ </ul>
119
+ <h2>Legal</h2>
120
+ <p>
121
+ Ruby License Copyright &#169;2004 Thomas Sawyer
122
+ </p>
123
+ <h2>History</h2>
124
+ <ul>
125
+ <li>2005.04.11 Passed basic test.
126
+
127
+ </li>
128
+ </ul>
129
+
130
+ </div>
131
+
132
+
133
+ </div>
134
+
135
+
136
+ </div>
137
+
138
+
139
+ <!-- if includes -->
140
+
141
+ <div id="section">
142
+
143
+
144
+
145
+
146
+
147
+
148
+
149
+
150
+ <!-- if method_list -->
151
+
152
+
153
+ </div>
154
+
155
+
156
+ <div id="validator-badges">
157
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
158
+ </div>
159
+
160
+ </body>
161
+ </html>
@@ -0,0 +1,204 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
+ <head>
8
+ <title>Module: Kernel</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
11
+ <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
12
+ <script type="text/javascript">
13
+ // <![CDATA[
14
+
15
+ function popupCode( url ) {
16
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
17
+ }
18
+
19
+ function toggleCode( id ) {
20
+ if ( document.getElementById )
21
+ elem = document.getElementById( id );
22
+ else if ( document.all )
23
+ elem = eval( "document.all." + id );
24
+ else
25
+ return false;
26
+
27
+ elemStyle = elem.style;
28
+
29
+ if ( elemStyle.display != "block" ) {
30
+ elemStyle.display = "block"
31
+ } else {
32
+ elemStyle.display = "none"
33
+ }
34
+
35
+ return true;
36
+ }
37
+
38
+ // Make codeblocks hidden by default
39
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
40
+
41
+ // ]]>
42
+ </script>
43
+
44
+ </head>
45
+ <body>
46
+
47
+
48
+
49
+ <div id="classHeader">
50
+ <table class="header-table">
51
+ <tr class="top-aligned-row">
52
+ <td><strong>Module</strong></td>
53
+ <td class="class-name-in-header">Kernel</td>
54
+ </tr>
55
+ <tr class="top-aligned-row">
56
+ <td><strong>In:</strong></td>
57
+ <td>
58
+ <a href="../files/lib/carat/nack_rb.html">
59
+ lib/carat/nack.rb
60
+ </a>
61
+ <br />
62
+ <a href="../files/lib/carat/ref_rb.html">
63
+ lib/carat/ref.rb
64
+ </a>
65
+ <br />
66
+ <a href="../files/lib/carat/timer_rb.html">
67
+ lib/carat/timer.rb
68
+ </a>
69
+ <br />
70
+ </td>
71
+ </tr>
72
+
73
+ </table>
74
+ </div>
75
+ <!-- banner header -->
76
+
77
+ <div id="bodyContent">
78
+
79
+
80
+
81
+ <div id="contextContent">
82
+
83
+ <div id="description">
84
+ <p>
85
+ Takes a block and returns the total time it took to execute.
86
+ </p>
87
+
88
+ </div>
89
+
90
+
91
+ </div>
92
+
93
+ <div id="method-list">
94
+ <h3 class="section-bar">Methods</h3>
95
+
96
+ <div class="name-list">
97
+ <a href="#M000617">nack</a>&nbsp;&nbsp;
98
+ <a href="#M000618">ref</a>&nbsp;&nbsp;
99
+ <a href="#M000619">timed</a>&nbsp;&nbsp;
100
+ </div>
101
+ </div>
102
+
103
+ </div>
104
+
105
+
106
+ <!-- if includes -->
107
+
108
+ <div id="section">
109
+
110
+
111
+
112
+
113
+
114
+
115
+
116
+
117
+ <!-- if method_list -->
118
+ <div id="methods">
119
+ <h3 class="section-bar">Public Instance methods</h3>
120
+
121
+ <div id="method-M000617" class="method-detail">
122
+ <a name="M000617"></a>
123
+
124
+ <div class="method-heading">
125
+ <a href="#M000617" class="method-signature">
126
+ <span class="method-name">nack</span><span class="method-args">(err=nil, *data, &amp;ctrl)</span>
127
+ </a>
128
+ </div>
129
+
130
+ <div class="method-description">
131
+ <p><a class="source-toggle" href="#"
132
+ onclick="toggleCode('M000617-source');return false;">[Source]</a></p>
133
+ <div class="method-source-code" id="M000617-source">
134
+ <pre>
135
+ <span class="ruby-comment cmt"># File lib/carat/nack.rb, line 97</span>
136
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">nack</span>(<span class="ruby-identifier">err</span>=<span class="ruby-keyword kw">nil</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">data</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">ctrl</span>)
137
+ <span class="ruby-constant">NackClass</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">err</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">data</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">ctrl</span>)
138
+ <span class="ruby-keyword kw">end</span>
139
+ </pre>
140
+ </div>
141
+ </div>
142
+ </div>
143
+
144
+ <div id="method-M000618" class="method-detail">
145
+ <a name="M000618"></a>
146
+
147
+ <div class="method-heading">
148
+ <a href="#M000618" class="method-signature">
149
+ <span class="method-name">ref</span><span class="method-args">(x)</span>
150
+ </a>
151
+ </div>
152
+
153
+ <div class="method-description">
154
+ <p><a class="source-toggle" href="#"
155
+ onclick="toggleCode('M000618-source');return false;">[Source]</a></p>
156
+ <div class="method-source-code" id="M000618-source">
157
+ <pre>
158
+ <span class="ruby-comment cmt"># File lib/carat/ref.rb, line 28</span>
159
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">ref</span>(<span class="ruby-identifier">x</span>)
160
+ <span class="ruby-constant">Ref</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">x</span>)
161
+ <span class="ruby-keyword kw">end</span>
162
+ </pre>
163
+ </div>
164
+ </div>
165
+ </div>
166
+
167
+ <div id="method-M000619" class="method-detail">
168
+ <a name="M000619"></a>
169
+
170
+ <div class="method-heading">
171
+ <a href="#M000619" class="method-signature">
172
+ <span class="method-name">timed</span><span class="method-args">() {|timer| ...}</span>
173
+ </a>
174
+ </div>
175
+
176
+ <div class="method-description">
177
+ <p><a class="source-toggle" href="#"
178
+ onclick="toggleCode('M000619-source');return false;">[Source]</a></p>
179
+ <div class="method-source-code" id="M000619-source">
180
+ <pre>
181
+ <span class="ruby-comment cmt"># File lib/carat/timer.rb, line 94</span>
182
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">timed</span>
183
+ <span class="ruby-identifier">timer</span> = <span class="ruby-constant">Timer</span>.<span class="ruby-identifier">new</span>
184
+ <span class="ruby-keyword kw">yield</span>(<span class="ruby-identifier">timer</span>)
185
+ <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">timer</span>.<span class="ruby-identifier">total_time</span>
186
+ <span class="ruby-keyword kw">end</span>
187
+ </pre>
188
+ </div>
189
+ </div>
190
+ </div>
191
+
192
+
193
+ </div>
194
+
195
+
196
+ </div>
197
+
198
+
199
+ <div id="validator-badges">
200
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
201
+ </div>
202
+
203
+ </body>
204
+ </html>
@@ -0,0 +1,1132 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
+ <head>
8
+ <title>Module: Lisp</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
11
+ <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
12
+ <script type="text/javascript">
13
+ // <![CDATA[
14
+
15
+ function popupCode( url ) {
16
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
17
+ }
18
+
19
+ function toggleCode( id ) {
20
+ if ( document.getElementById )
21
+ elem = document.getElementById( id );
22
+ else if ( document.all )
23
+ elem = eval( "document.all." + id );
24
+ else
25
+ return false;
26
+
27
+ elemStyle = elem.style;
28
+
29
+ if ( elemStyle.display != "block" ) {
30
+ elemStyle.display = "block"
31
+ } else {
32
+ elemStyle.display = "none"
33
+ }
34
+
35
+ return true;
36
+ }
37
+
38
+ // Make codeblocks hidden by default
39
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
40
+
41
+ // ]]>
42
+ </script>
43
+
44
+ </head>
45
+ <body>
46
+
47
+
48
+
49
+ <div id="classHeader">
50
+ <table class="header-table">
51
+ <tr class="top-aligned-row">
52
+ <td><strong>Module</strong></td>
53
+ <td class="class-name-in-header">Lisp</td>
54
+ </tr>
55
+ <tr class="top-aligned-row">
56
+ <td><strong>In:</strong></td>
57
+ <td>
58
+ <a href="../files/lib/carat/lisp-format_rb.html">
59
+ lib/carat/lisp-format.rb
60
+ </a>
61
+ <br />
62
+ <a href="../files/lib/carat/lisp_rb.html">
63
+ lib/carat/lisp.rb
64
+ </a>
65
+ <br />
66
+ </td>
67
+ </tr>
68
+
69
+ </table>
70
+ </div>
71
+ <!-- banner header -->
72
+
73
+ <div id="bodyContent">
74
+
75
+
76
+
77
+ <div id="contextContent">
78
+
79
+ <div id="description">
80
+ <h1><a href="Lisp.html">Lisp</a> Mixin</h1>
81
+ <p>
82
+ This module provides <a href="Lisp.html">Lisp</a>-like functional notation.
83
+ With this module it almost possibel to write real <a
84
+ href="Lisp.html">Lisp</a> code in Ruby.
85
+ </p>
86
+ <h2>Example</h2>
87
+ <p>
88
+ It&#8217;s hardly believable, but the following IS valid ruby code:
89
+ </p>
90
+ <pre>
91
+ (def accumulate (fun, x, list)
92
+ (if (null? list)
93
+ x
94
+ else
95
+ (accumulate fun, (fun.call x, (car list)), (cdr list))
96
+ end)
97
+ end)
98
+ </pre>
99
+ <p>
100
+ A real programmer can write LISP in any language&#8230; ;)
101
+ </p>
102
+ <h2>Author(s)</h2>
103
+ <ul>
104
+ <li>Florian Frank
105
+
106
+ </li>
107
+ <li>Thomas Sawyer
108
+
109
+ </li>
110
+ </ul>
111
+ <h2>Legal</h2>
112
+ <p>
113
+ Based on original work func.rb by Florain Frank. Copyright &#169;2005
114
+ Florian Frank &lt;flori@ping.de&gt; Ruby License
115
+ </p>
116
+ <h2>History</h2>
117
+ <ul>
118
+ <li>2005.04.12
119
+
120
+ </li>
121
+ </ul>
122
+ <p>
123
+ ** Changed the name of Pair class to <a
124
+ href="Lisp/DottedPair.html">DottedPair</a>. ** Added a new method <a
125
+ href="Lisp.html#M000432">pair!</a> which converts an array to a <a
126
+ href="Lisp/DottedPair.html">DottedPair</a>. ** This is then used in <a
127
+ href="Lisp.html#M000425">car</a> and <a href="Lisp.html#M000426">cdr</a> to
128
+ automatically convert arrays passed to them. ** Note: There may be other
129
+ places that <a href="Lisp.html#M000432">pair!</a> conversion is needed.
130
+ </p>
131
+
132
+ </div>
133
+
134
+
135
+ </div>
136
+
137
+ <div id="method-list">
138
+ <h3 class="section-bar">Methods</h3>
139
+
140
+ <div class="name-list">
141
+ <a href="#M000446">accumulate</a>&nbsp;&nbsp;
142
+ <a href="#M000445">all?</a>&nbsp;&nbsp;
143
+ <a href="#M000436">append</a>&nbsp;&nbsp;
144
+ <a href="#M000443">assoc</a>&nbsp;&nbsp;
145
+ <a href="#M000433">atom?</a>&nbsp;&nbsp;
146
+ <a href="#M000425">car</a>&nbsp;&nbsp;
147
+ <a href="#M000426">cdr</a>&nbsp;&nbsp;
148
+ <a href="#M000423">cons</a>&nbsp;&nbsp;
149
+ <a href="#M000424">consonto</a>&nbsp;&nbsp;
150
+ <a href="#M000457">drop</a>&nbsp;&nbsp;
151
+ <a href="#M000434">equal?</a>&nbsp;&nbsp;
152
+ <a href="#M000444">exists?</a>&nbsp;&nbsp;
153
+ <a href="#M000451">explode</a>&nbsp;&nbsp;
154
+ <a href="#M000442">filter</a>&nbsp;&nbsp;
155
+ <a href="#M000447">foldleft</a>&nbsp;&nbsp;
156
+ <a href="#M000449">foldright</a>&nbsp;&nbsp;
157
+ <a href="#M000422">format</a>&nbsp;&nbsp;
158
+ <a href="#M000452">implode</a>&nbsp;&nbsp;
159
+ <a href="#M000437">length</a>&nbsp;&nbsp;
160
+ <a href="#M000450">link</a>&nbsp;&nbsp;
161
+ <a href="#M000435">list</a>&nbsp;&nbsp;
162
+ <a href="#M000438">map</a>&nbsp;&nbsp;
163
+ <a href="#M000441">member?</a>&nbsp;&nbsp;
164
+ <a href="#M000430">null?</a>&nbsp;&nbsp;
165
+ <a href="#M000432">pair!</a>&nbsp;&nbsp;
166
+ <a href="#M000431">pair?</a>&nbsp;&nbsp;
167
+ <a href="#M000440">pairlis</a>&nbsp;&nbsp;
168
+ <a href="#M000454">prod</a>&nbsp;&nbsp;
169
+ <a href="#M000448">reduce</a>&nbsp;&nbsp;
170
+ <a href="#M000455">reverse</a>&nbsp;&nbsp;
171
+ <a href="#M000427">set</a>&nbsp;&nbsp;
172
+ <a href="#M000428">set_car!</a>&nbsp;&nbsp;
173
+ <a href="#M000429">set_cdr!</a>&nbsp;&nbsp;
174
+ <a href="#M000453">sum</a>&nbsp;&nbsp;
175
+ <a href="#M000456">take</a>&nbsp;&nbsp;
176
+ <a href="#M000439">zip</a>&nbsp;&nbsp;
177
+ </div>
178
+ </div>
179
+
180
+ </div>
181
+
182
+
183
+ <!-- if includes -->
184
+
185
+ <div id="section">
186
+
187
+ <div id="class-list">
188
+ <h3 class="section-bar">Classes and Modules</h3>
189
+
190
+ Module <a href="Lisp/Format.html" class="link">Lisp::Format</a><br />
191
+ Class <a href="Lisp/DottedPair.html" class="link">Lisp::DottedPair</a><br />
192
+
193
+ </div>
194
+
195
+ <div id="constants-list">
196
+ <h3 class="section-bar">Constants</h3>
197
+
198
+ <div class="name-list">
199
+ <table summary="Constants">
200
+ <tr class="top-aligned-row context-row">
201
+ <td class="context-item-name">VERSION</td>
202
+ <td>=</td>
203
+ <td class="context-item-value">1.1</td>
204
+ </tr>
205
+ </table>
206
+ </div>
207
+ </div>
208
+
209
+
210
+
211
+
212
+
213
+
214
+ <!-- if method_list -->
215
+ <div id="methods">
216
+ <h3 class="section-bar">Public Class methods</h3>
217
+
218
+ <div id="method-M000422" class="method-detail">
219
+ <a name="M000422"></a>
220
+
221
+ <div class="method-heading">
222
+ <a href="#M000422" class="method-signature">
223
+ <span class="method-name">format</span><span class="method-args">(format, *args)</span>
224
+ </a>
225
+ </div>
226
+
227
+ <div class="method-description">
228
+ <p><a class="source-toggle" href="#"
229
+ onclick="toggleCode('M000422-source');return false;">[Source]</a></p>
230
+ <div class="method-source-code" id="M000422-source">
231
+ <pre>
232
+ <span class="ruby-comment cmt"># File lib/carat/lisp-format.rb, line 1788</span>
233
+ <span class="ruby-keyword kw">def</span> <span class="ruby-constant">Lisp</span>.<span class="ruby-identifier">format</span>(<span class="ruby-identifier">format</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
234
+ <span class="ruby-keyword kw">begin</span>
235
+ <span class="ruby-identifier">state</span> = <span class="ruby-constant">Format</span><span class="ruby-operator">::</span><span class="ruby-constant">State</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">args</span>, <span class="ruby-constant">Format</span><span class="ruby-operator">::</span><span class="ruby-constant">Output</span>.<span class="ruby-identifier">new</span>)
236
+ <span class="ruby-identifier">formatter</span> = <span class="ruby-constant">Format</span><span class="ruby-operator">::</span><span class="ruby-constant">Formatter</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">format</span>, <span class="ruby-identifier">state</span>)
237
+ <span class="ruby-identifier">formatter</span>.<span class="ruby-identifier">run</span>
238
+ <span class="ruby-keyword kw">rescue</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">e</span>
239
+ <span class="ruby-identifier">puts</span> <span class="ruby-value str">'Format error: '</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">e</span>.<span class="ruby-identifier">message</span>
240
+ <span class="ruby-identifier">puts</span> <span class="ruby-identifier">format</span>
241
+ <span class="ruby-identifier">puts</span> <span class="ruby-value str">' '</span> <span class="ruby-operator">*</span> (<span class="ruby-identifier">e</span>.<span class="ruby-identifier">pos</span> <span class="ruby-operator">-</span> <span class="ruby-value">1</span>) <span class="ruby-operator">+</span> <span class="ruby-value str">'^'</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">e</span>.<span class="ruby-identifier">respond_to?</span> <span class="ruby-identifier">:pos</span>
242
+ <span class="ruby-identifier">raise</span>
243
+ <span class="ruby-keyword kw">end</span>
244
+ <span class="ruby-keyword kw">end</span>
245
+ </pre>
246
+ </div>
247
+ </div>
248
+ </div>
249
+
250
+ <h3 class="section-bar">Public Instance methods</h3>
251
+
252
+ <div id="method-M000446" class="method-detail">
253
+ <a name="M000446"></a>
254
+
255
+ <div class="method-heading">
256
+ <a href="#M000446" class="method-signature">
257
+ <span class="method-name">accumulate</span><span class="method-args">(fun, x, list)</span>
258
+ </a>
259
+ </div>
260
+
261
+ <div class="method-description">
262
+ <p><a class="source-toggle" href="#"
263
+ onclick="toggleCode('M000446-source');return false;">[Source]</a></p>
264
+ <div class="method-source-code" id="M000446-source">
265
+ <pre>
266
+ <span class="ruby-comment cmt"># File lib/carat/lisp.rb, line 276</span>
267
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">accumulate</span>(<span class="ruby-identifier">fun</span>, <span class="ruby-identifier">x</span>, <span class="ruby-identifier">list</span>)
268
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">null?</span>(<span class="ruby-identifier">list</span>)
269
+ <span class="ruby-identifier">x</span>
270
+ <span class="ruby-keyword kw">else</span>
271
+ <span class="ruby-identifier">accumulate</span>(<span class="ruby-identifier">fun</span>, <span class="ruby-identifier">fun</span>.<span class="ruby-identifier">call</span>(<span class="ruby-identifier">x</span>, <span class="ruby-identifier">car</span>(<span class="ruby-identifier">list</span>)), <span class="ruby-identifier">cdr</span>(<span class="ruby-identifier">list</span>))
272
+ <span class="ruby-keyword kw">end</span>
273
+ <span class="ruby-keyword kw">end</span>
274
+ </pre>
275
+ </div>
276
+ </div>
277
+ </div>
278
+
279
+ <div id="method-M000445" class="method-detail">
280
+ <a name="M000445"></a>
281
+
282
+ <div class="method-heading">
283
+ <a href="#M000445" class="method-signature">
284
+ <span class="method-name">all?</span><span class="method-args">(pred, list)</span>
285
+ </a>
286
+ </div>
287
+
288
+ <div class="method-description">
289
+ <p><a class="source-toggle" href="#"
290
+ onclick="toggleCode('M000445-source');return false;">[Source]</a></p>
291
+ <div class="method-source-code" id="M000445-source">
292
+ <pre>
293
+ <span class="ruby-comment cmt"># File lib/carat/lisp.rb, line 264</span>
294
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">all?</span>(<span class="ruby-identifier">pred</span>, <span class="ruby-identifier">list</span>)
295
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">null?</span>(<span class="ruby-identifier">list</span>)
296
+ <span class="ruby-keyword kw">true</span>
297
+ <span class="ruby-keyword kw">else</span>
298
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">pred</span>.<span class="ruby-identifier">call</span>(<span class="ruby-identifier">car</span>(<span class="ruby-identifier">list</span>))
299
+ <span class="ruby-identifier">all?</span>(<span class="ruby-identifier">pred</span>, <span class="ruby-identifier">cdr</span>(<span class="ruby-identifier">list</span>))
300
+ <span class="ruby-keyword kw">else</span>
301
+ <span class="ruby-keyword kw">false</span>
302
+ <span class="ruby-keyword kw">end</span>
303
+ <span class="ruby-keyword kw">end</span>
304
+ <span class="ruby-keyword kw">end</span>
305
+ </pre>
306
+ </div>
307
+ </div>
308
+ </div>
309
+
310
+ <div id="method-M000436" class="method-detail">
311
+ <a name="M000436"></a>
312
+
313
+ <div class="method-heading">
314
+ <a href="#M000436" class="method-signature">
315
+ <span class="method-name">append</span><span class="method-args">(l, m)</span>
316
+ </a>
317
+ </div>
318
+
319
+ <div class="method-description">
320
+ <p><a class="source-toggle" href="#"
321
+ onclick="toggleCode('M000436-source');return false;">[Source]</a></p>
322
+ <div class="method-source-code" id="M000436-source">
323
+ <pre>
324
+ <span class="ruby-comment cmt"># File lib/carat/lisp.rb, line 181</span>
325
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">append</span>(<span class="ruby-identifier">l</span>, <span class="ruby-identifier">m</span>)
326
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">null?</span>(<span class="ruby-identifier">l</span>)
327
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">null?</span>(<span class="ruby-identifier">m</span>)
328
+ <span class="ruby-keyword kw">nil</span>
329
+ <span class="ruby-keyword kw">else</span>
330
+ <span class="ruby-identifier">cons</span>(<span class="ruby-identifier">car</span>(<span class="ruby-identifier">m</span>), <span class="ruby-identifier">append</span>(<span class="ruby-identifier">l</span>, <span class="ruby-identifier">cdr</span>(<span class="ruby-identifier">m</span>)))
331
+ <span class="ruby-keyword kw">end</span>
332
+ <span class="ruby-keyword kw">else</span>
333
+ <span class="ruby-identifier">cons</span>(<span class="ruby-identifier">car</span>(<span class="ruby-identifier">l</span>), <span class="ruby-identifier">append</span>(<span class="ruby-identifier">cdr</span>(<span class="ruby-identifier">l</span>), <span class="ruby-identifier">m</span>))
334
+ <span class="ruby-keyword kw">end</span>
335
+ <span class="ruby-keyword kw">end</span>
336
+ </pre>
337
+ </div>
338
+ </div>
339
+ </div>
340
+
341
+ <div id="method-M000443" class="method-detail">
342
+ <a name="M000443"></a>
343
+
344
+ <div class="method-heading">
345
+ <a href="#M000443" class="method-signature">
346
+ <span class="method-name">assoc</span><span class="method-args">(x, list)</span>
347
+ </a>
348
+ </div>
349
+
350
+ <div class="method-description">
351
+ <p><a class="source-toggle" href="#"
352
+ onclick="toggleCode('M000443-source');return false;">[Source]</a></p>
353
+ <div class="method-source-code" id="M000443-source">
354
+ <pre>
355
+ <span class="ruby-comment cmt"># File lib/carat/lisp.rb, line 247</span>
356
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">assoc</span>(<span class="ruby-identifier">x</span>, <span class="ruby-identifier">list</span>)
357
+ <span class="ruby-identifier">f</span> = <span class="ruby-identifier">filter</span>(<span class="ruby-identifier">lambda</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">y</span><span class="ruby-operator">|</span> <span class="ruby-identifier">x</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">car</span>(<span class="ruby-identifier">y</span>)}, <span class="ruby-identifier">list</span>)
358
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">null?</span>(<span class="ruby-identifier">f</span>) <span class="ruby-keyword kw">then</span> <span class="ruby-keyword kw">nil</span> <span class="ruby-keyword kw">else</span> <span class="ruby-identifier">car</span>(<span class="ruby-identifier">f</span>) <span class="ruby-keyword kw">end</span>
359
+ <span class="ruby-keyword kw">end</span>
360
+ </pre>
361
+ </div>
362
+ </div>
363
+ </div>
364
+
365
+ <div id="method-M000433" class="method-detail">
366
+ <a name="M000433"></a>
367
+
368
+ <div class="method-heading">
369
+ <a href="#M000433" class="method-signature">
370
+ <span class="method-name">atom?</span><span class="method-args">(x)</span>
371
+ </a>
372
+ </div>
373
+
374
+ <div class="method-description">
375
+ <p><a class="source-toggle" href="#"
376
+ onclick="toggleCode('M000433-source');return false;">[Source]</a></p>
377
+ <div class="method-source-code" id="M000433-source">
378
+ <pre>
379
+ <span class="ruby-comment cmt"># File lib/carat/lisp.rb, line 165</span>
380
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">atom?</span>(<span class="ruby-identifier">x</span>)
381
+ <span class="ruby-keyword kw">not</span> <span class="ruby-identifier">pair?</span>(<span class="ruby-identifier">x</span>) <span class="ruby-operator">||</span> <span class="ruby-identifier">null?</span>(<span class="ruby-identifier">x</span>)
382
+ <span class="ruby-keyword kw">end</span>
383
+ </pre>
384
+ </div>
385
+ </div>
386
+ </div>
387
+
388
+ <div id="method-M000425" class="method-detail">
389
+ <a name="M000425"></a>
390
+
391
+ <div class="method-heading">
392
+ <a href="#M000425" class="method-signature">
393
+ <span class="method-name">car</span><span class="method-args">(pair)</span>
394
+ </a>
395
+ </div>
396
+
397
+ <div class="method-description">
398
+ <p><a class="source-toggle" href="#"
399
+ onclick="toggleCode('M000425-source');return false;">[Source]</a></p>
400
+ <div class="method-source-code" id="M000425-source">
401
+ <pre>
402
+ <span class="ruby-comment cmt"># File lib/carat/lisp.rb, line 130</span>
403
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">car</span>(<span class="ruby-identifier">pair</span>)
404
+ <span class="ruby-identifier">pair</span> = <span class="ruby-identifier">pair!</span>(<span class="ruby-identifier">pair</span>)
405
+ <span class="ruby-identifier">pair</span>.<span class="ruby-identifier">first</span>
406
+ <span class="ruby-keyword kw">end</span>
407
+ </pre>
408
+ </div>
409
+ </div>
410
+ </div>
411
+
412
+ <div id="method-M000426" class="method-detail">
413
+ <a name="M000426"></a>
414
+
415
+ <div class="method-heading">
416
+ <a href="#M000426" class="method-signature">
417
+ <span class="method-name">cdr</span><span class="method-args">(pair)</span>
418
+ </a>
419
+ </div>
420
+
421
+ <div class="method-description">
422
+ <p><a class="source-toggle" href="#"
423
+ onclick="toggleCode('M000426-source');return false;">[Source]</a></p>
424
+ <div class="method-source-code" id="M000426-source">
425
+ <pre>
426
+ <span class="ruby-comment cmt"># File lib/carat/lisp.rb, line 135</span>
427
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">cdr</span>(<span class="ruby-identifier">pair</span>)
428
+ <span class="ruby-identifier">pair</span> = <span class="ruby-identifier">pair!</span>(<span class="ruby-identifier">pair</span>)
429
+ <span class="ruby-identifier">pair</span>.<span class="ruby-identifier">second</span>
430
+ <span class="ruby-keyword kw">end</span>
431
+ </pre>
432
+ </div>
433
+ </div>
434
+ </div>
435
+
436
+ <div id="method-M000423" class="method-detail">
437
+ <a name="M000423"></a>
438
+
439
+ <div class="method-heading">
440
+ <a href="#M000423" class="method-signature">
441
+ <span class="method-name">cons</span><span class="method-args">(car, cdr)</span>
442
+ </a>
443
+ </div>
444
+
445
+ <div class="method-description">
446
+ <p>
447
+ Functional API
448
+ </p>
449
+ <p><a class="source-toggle" href="#"
450
+ onclick="toggleCode('M000423-source');return false;">[Source]</a></p>
451
+ <div class="method-source-code" id="M000423-source">
452
+ <pre>
453
+ <span class="ruby-comment cmt"># File lib/carat/lisp.rb, line 122</span>
454
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">cons</span>(<span class="ruby-identifier">car</span>, <span class="ruby-identifier">cdr</span>)
455
+ <span class="ruby-constant">DottedPair</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">car</span>, <span class="ruby-identifier">cdr</span>)
456
+ <span class="ruby-keyword kw">end</span>
457
+ </pre>
458
+ </div>
459
+ </div>
460
+ </div>
461
+
462
+ <div id="method-M000424" class="method-detail">
463
+ <a name="M000424"></a>
464
+
465
+ <div class="method-heading">
466
+ <a href="#M000424" class="method-signature">
467
+ <span class="method-name">consonto</span><span class="method-args">(cdr, car)</span>
468
+ </a>
469
+ </div>
470
+
471
+ <div class="method-description">
472
+ <p><a class="source-toggle" href="#"
473
+ onclick="toggleCode('M000424-source');return false;">[Source]</a></p>
474
+ <div class="method-source-code" id="M000424-source">
475
+ <pre>
476
+ <span class="ruby-comment cmt"># File lib/carat/lisp.rb, line 126</span>
477
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">consonto</span>(<span class="ruby-identifier">cdr</span>, <span class="ruby-identifier">car</span>)
478
+ <span class="ruby-constant">DottedPair</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">car</span>, <span class="ruby-identifier">cdr</span>)
479
+ <span class="ruby-keyword kw">end</span>
480
+ </pre>
481
+ </div>
482
+ </div>
483
+ </div>
484
+
485
+ <div id="method-M000457" class="method-detail">
486
+ <a name="M000457"></a>
487
+
488
+ <div class="method-heading">
489
+ <a href="#M000457" class="method-signature">
490
+ <span class="method-name">drop</span><span class="method-args">(l, n)</span>
491
+ </a>
492
+ </div>
493
+
494
+ <div class="method-description">
495
+ <p><a class="source-toggle" href="#"
496
+ onclick="toggleCode('M000457-source');return false;">[Source]</a></p>
497
+ <div class="method-source-code" id="M000457-source">
498
+ <pre>
499
+ <span class="ruby-comment cmt"># File lib/carat/lisp.rb, line 328</span>
500
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">drop</span>(<span class="ruby-identifier">l</span>, <span class="ruby-identifier">n</span>)
501
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">n</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">0</span> <span class="ruby-keyword kw">and</span> <span class="ruby-keyword kw">not</span> <span class="ruby-identifier">null?</span>(<span class="ruby-identifier">l</span>)
502
+ <span class="ruby-identifier">drop</span>(<span class="ruby-identifier">cdr</span>(<span class="ruby-identifier">l</span>), <span class="ruby-identifier">n</span> <span class="ruby-operator">-</span> <span class="ruby-value">1</span>)
503
+ <span class="ruby-keyword kw">else</span>
504
+ <span class="ruby-identifier">l</span>
505
+ <span class="ruby-keyword kw">end</span>
506
+ <span class="ruby-keyword kw">end</span>
507
+ </pre>
508
+ </div>
509
+ </div>
510
+ </div>
511
+
512
+ <div id="method-M000434" class="method-detail">
513
+ <a name="M000434"></a>
514
+
515
+ <div class="method-heading">
516
+ <a href="#M000434" class="method-signature">
517
+ <span class="method-name">equal?</span><span class="method-args">(l, m)</span>
518
+ </a>
519
+ </div>
520
+
521
+ <div class="method-description">
522
+ <p><a class="source-toggle" href="#"
523
+ onclick="toggleCode('M000434-source');return false;">[Source]</a></p>
524
+ <div class="method-source-code" id="M000434-source">
525
+ <pre>
526
+ <span class="ruby-comment cmt"># File lib/carat/lisp.rb, line 169</span>
527
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">equal?</span>(<span class="ruby-identifier">l</span>, <span class="ruby-identifier">m</span>)
528
+ <span class="ruby-identifier">l</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">m</span>
529
+ <span class="ruby-keyword kw">end</span>
530
+ </pre>
531
+ </div>
532
+ </div>
533
+ </div>
534
+
535
+ <div id="method-M000444" class="method-detail">
536
+ <a name="M000444"></a>
537
+
538
+ <div class="method-heading">
539
+ <a href="#M000444" class="method-signature">
540
+ <span class="method-name">exists?</span><span class="method-args">(pred, list)</span>
541
+ </a>
542
+ </div>
543
+
544
+ <div class="method-description">
545
+ <p><a class="source-toggle" href="#"
546
+ onclick="toggleCode('M000444-source');return false;">[Source]</a></p>
547
+ <div class="method-source-code" id="M000444-source">
548
+ <pre>
549
+ <span class="ruby-comment cmt"># File lib/carat/lisp.rb, line 252</span>
550
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">exists?</span>(<span class="ruby-identifier">pred</span>, <span class="ruby-identifier">list</span>)
551
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">null?</span>(<span class="ruby-identifier">list</span>)
552
+ <span class="ruby-keyword kw">false</span>
553
+ <span class="ruby-keyword kw">else</span>
554
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">pred</span>.<span class="ruby-identifier">call</span>(<span class="ruby-identifier">car</span>(<span class="ruby-identifier">list</span>))
555
+ <span class="ruby-keyword kw">true</span>
556
+ <span class="ruby-keyword kw">else</span>
557
+ <span class="ruby-identifier">exists?</span>(<span class="ruby-identifier">pred</span>, <span class="ruby-identifier">cdr</span>(<span class="ruby-identifier">list</span>))
558
+ <span class="ruby-keyword kw">end</span>
559
+ <span class="ruby-keyword kw">end</span>
560
+ <span class="ruby-keyword kw">end</span>
561
+ </pre>
562
+ </div>
563
+ </div>
564
+ </div>
565
+
566
+ <div id="method-M000451" class="method-detail">
567
+ <a name="M000451"></a>
568
+
569
+ <div class="method-heading">
570
+ <a href="#M000451" class="method-signature">
571
+ <span class="method-name">explode</span><span class="method-args">(string)</span>
572
+ </a>
573
+ </div>
574
+
575
+ <div class="method-description">
576
+ <p><a class="source-toggle" href="#"
577
+ onclick="toggleCode('M000451-source');return false;">[Source]</a></p>
578
+ <div class="method-source-code" id="M000451-source">
579
+ <pre>
580
+ <span class="ruby-comment cmt"># File lib/carat/lisp.rb, line 300</span>
581
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">explode</span>(<span class="ruby-identifier">string</span>)
582
+ <span class="ruby-identifier">list</span>(<span class="ruby-operator">*</span>(<span class="ruby-identifier">string</span>.<span class="ruby-identifier">split</span>(<span class="ruby-regexp re">//</span>)))
583
+ <span class="ruby-keyword kw">end</span>
584
+ </pre>
585
+ </div>
586
+ </div>
587
+ </div>
588
+
589
+ <div id="method-M000442" class="method-detail">
590
+ <a name="M000442"></a>
591
+
592
+ <div class="method-heading">
593
+ <a href="#M000442" class="method-signature">
594
+ <span class="method-name">filter</span><span class="method-args">(pred, list)</span>
595
+ </a>
596
+ </div>
597
+
598
+ <div class="method-description">
599
+ <p><a class="source-toggle" href="#"
600
+ onclick="toggleCode('M000442-source');return false;">[Source]</a></p>
601
+ <div class="method-source-code" id="M000442-source">
602
+ <pre>
603
+ <span class="ruby-comment cmt"># File lib/carat/lisp.rb, line 235</span>
604
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">filter</span>(<span class="ruby-identifier">pred</span>, <span class="ruby-identifier">list</span>)
605
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">null?</span>(<span class="ruby-identifier">list</span>)
606
+ <span class="ruby-keyword kw">nil</span>
607
+ <span class="ruby-keyword kw">else</span>
608
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">pred</span>.<span class="ruby-identifier">call</span>(<span class="ruby-identifier">car</span>(<span class="ruby-identifier">list</span>))
609
+ <span class="ruby-identifier">cons</span>(<span class="ruby-identifier">car</span>(<span class="ruby-identifier">list</span>), <span class="ruby-identifier">filter</span>(<span class="ruby-identifier">pred</span>, <span class="ruby-identifier">cdr</span>(<span class="ruby-identifier">list</span>)))
610
+ <span class="ruby-keyword kw">else</span>
611
+ <span class="ruby-identifier">filter</span>(<span class="ruby-identifier">pred</span>, <span class="ruby-identifier">cdr</span>(<span class="ruby-identifier">list</span>))
612
+ <span class="ruby-keyword kw">end</span>
613
+ <span class="ruby-keyword kw">end</span>
614
+ <span class="ruby-keyword kw">end</span>
615
+ </pre>
616
+ </div>
617
+ </div>
618
+ </div>
619
+
620
+ <div id="method-M000447" class="method-detail">
621
+ <a name="M000447"></a>
622
+
623
+ <div class="method-heading">
624
+ <span class="method-name">foldleft</span><span class="method-args">(fun, x, list)</span>
625
+ </div>
626
+
627
+ <div class="method-description">
628
+ <p>
629
+ Alias for <a href="Lisp.html#M000446">accumulate</a>
630
+ </p>
631
+ </div>
632
+ </div>
633
+
634
+ <div id="method-M000449" class="method-detail">
635
+ <a name="M000449"></a>
636
+
637
+ <div class="method-heading">
638
+ <span class="method-name">foldright</span><span class="method-args">(fun, x, list)</span>
639
+ </div>
640
+
641
+ <div class="method-description">
642
+ <p>
643
+ Alias for <a href="Lisp.html#M000448">reduce</a>
644
+ </p>
645
+ </div>
646
+ </div>
647
+
648
+ <div id="method-M000452" class="method-detail">
649
+ <a name="M000452"></a>
650
+
651
+ <div class="method-heading">
652
+ <a href="#M000452" class="method-signature">
653
+ <span class="method-name">implode</span><span class="method-args">(list)</span>
654
+ </a>
655
+ </div>
656
+
657
+ <div class="method-description">
658
+ <p><a class="source-toggle" href="#"
659
+ onclick="toggleCode('M000452-source');return false;">[Source]</a></p>
660
+ <div class="method-source-code" id="M000452-source">
661
+ <pre>
662
+ <span class="ruby-comment cmt"># File lib/carat/lisp.rb, line 304</span>
663
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">implode</span>(<span class="ruby-identifier">list</span>)
664
+ <span class="ruby-identifier">accumulate</span>(<span class="ruby-identifier">lambda</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">x</span>, <span class="ruby-identifier">y</span><span class="ruby-operator">|</span> <span class="ruby-identifier">x</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">y</span> }, <span class="ruby-value str">''</span>, <span class="ruby-identifier">list</span>)
665
+ <span class="ruby-keyword kw">end</span>
666
+ </pre>
667
+ </div>
668
+ </div>
669
+ </div>
670
+
671
+ <div id="method-M000437" class="method-detail">
672
+ <a name="M000437"></a>
673
+
674
+ <div class="method-heading">
675
+ <a href="#M000437" class="method-signature">
676
+ <span class="method-name">length</span><span class="method-args">(list)</span>
677
+ </a>
678
+ </div>
679
+
680
+ <div class="method-description">
681
+ <p><a class="source-toggle" href="#"
682
+ onclick="toggleCode('M000437-source');return false;">[Source]</a></p>
683
+ <div class="method-source-code" id="M000437-source">
684
+ <pre>
685
+ <span class="ruby-comment cmt"># File lib/carat/lisp.rb, line 193</span>
686
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">length</span>(<span class="ruby-identifier">list</span>)
687
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">null?</span>(<span class="ruby-identifier">list</span>)
688
+ <span class="ruby-value">0</span>
689
+ <span class="ruby-keyword kw">else</span>
690
+ <span class="ruby-value">1</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">length</span>(<span class="ruby-identifier">cdr</span>(<span class="ruby-identifier">list</span>))
691
+ <span class="ruby-keyword kw">end</span>
692
+ <span class="ruby-keyword kw">end</span>
693
+ </pre>
694
+ </div>
695
+ </div>
696
+ </div>
697
+
698
+ <div id="method-M000450" class="method-detail">
699
+ <a name="M000450"></a>
700
+
701
+ <div class="method-heading">
702
+ <a href="#M000450" class="method-signature">
703
+ <span class="method-name">link</span><span class="method-args">(lists)</span>
704
+ </a>
705
+ </div>
706
+
707
+ <div class="method-description">
708
+ <p><a class="source-toggle" href="#"
709
+ onclick="toggleCode('M000450-source');return false;">[Source]</a></p>
710
+ <div class="method-source-code" id="M000450-source">
711
+ <pre>
712
+ <span class="ruby-comment cmt"># File lib/carat/lisp.rb, line 296</span>
713
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">link</span>(<span class="ruby-identifier">lists</span>)
714
+ <span class="ruby-identifier">accumulate</span>(<span class="ruby-identifier">lambda</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">x</span>, <span class="ruby-identifier">y</span><span class="ruby-operator">|</span> <span class="ruby-identifier">append</span>(<span class="ruby-identifier">x</span>, <span class="ruby-identifier">y</span>) }, <span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">lists</span>)
715
+ <span class="ruby-keyword kw">end</span>
716
+ </pre>
717
+ </div>
718
+ </div>
719
+ </div>
720
+
721
+ <div id="method-M000435" class="method-detail">
722
+ <a name="M000435"></a>
723
+
724
+ <div class="method-heading">
725
+ <a href="#M000435" class="method-signature">
726
+ <span class="method-name">list</span><span class="method-args">(*elms)</span>
727
+ </a>
728
+ </div>
729
+
730
+ <div class="method-description">
731
+ <p><a class="source-toggle" href="#"
732
+ onclick="toggleCode('M000435-source');return false;">[Source]</a></p>
733
+ <div class="method-source-code" id="M000435-source">
734
+ <pre>
735
+ <span class="ruby-comment cmt"># File lib/carat/lisp.rb, line 173</span>
736
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">list</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">elms</span>)
737
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">elms</span>.<span class="ruby-identifier">empty?</span>
738
+ <span class="ruby-keyword kw">nil</span>
739
+ <span class="ruby-keyword kw">else</span>
740
+ <span class="ruby-identifier">cons</span>(<span class="ruby-identifier">elms</span>.<span class="ruby-identifier">shift</span>, <span class="ruby-identifier">list</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">elms</span>))
741
+ <span class="ruby-keyword kw">end</span>
742
+ <span class="ruby-keyword kw">end</span>
743
+ </pre>
744
+ </div>
745
+ </div>
746
+ </div>
747
+
748
+ <div id="method-M000438" class="method-detail">
749
+ <a name="M000438"></a>
750
+
751
+ <div class="method-heading">
752
+ <a href="#M000438" class="method-signature">
753
+ <span class="method-name">map</span><span class="method-args">(fun, list)</span>
754
+ </a>
755
+ </div>
756
+
757
+ <div class="method-description">
758
+ <p><a class="source-toggle" href="#"
759
+ onclick="toggleCode('M000438-source');return false;">[Source]</a></p>
760
+ <div class="method-source-code" id="M000438-source">
761
+ <pre>
762
+ <span class="ruby-comment cmt"># File lib/carat/lisp.rb, line 201</span>
763
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">map</span>(<span class="ruby-identifier">fun</span>, <span class="ruby-identifier">list</span>)
764
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">null?</span>(<span class="ruby-identifier">list</span>)
765
+ <span class="ruby-keyword kw">nil</span>
766
+ <span class="ruby-keyword kw">else</span>
767
+ <span class="ruby-identifier">cons</span>(<span class="ruby-identifier">fun</span>.<span class="ruby-identifier">call</span>(<span class="ruby-identifier">car</span>(<span class="ruby-identifier">list</span>)), <span class="ruby-identifier">map</span>(<span class="ruby-identifier">fun</span>, <span class="ruby-identifier">cdr</span>(<span class="ruby-identifier">list</span>)))
768
+ <span class="ruby-keyword kw">end</span>
769
+ <span class="ruby-keyword kw">end</span>
770
+ </pre>
771
+ </div>
772
+ </div>
773
+ </div>
774
+
775
+ <div id="method-M000441" class="method-detail">
776
+ <a name="M000441"></a>
777
+
778
+ <div class="method-heading">
779
+ <a href="#M000441" class="method-signature">
780
+ <span class="method-name">member?</span><span class="method-args">(x, list)</span>
781
+ </a>
782
+ </div>
783
+
784
+ <div class="method-description">
785
+ <p><a class="source-toggle" href="#"
786
+ onclick="toggleCode('M000441-source');return false;">[Source]</a></p>
787
+ <div class="method-source-code" id="M000441-source">
788
+ <pre>
789
+ <span class="ruby-comment cmt"># File lib/carat/lisp.rb, line 223</span>
790
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">member?</span>(<span class="ruby-identifier">x</span>, <span class="ruby-identifier">list</span>)
791
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">null?</span>(<span class="ruby-identifier">list</span>)
792
+ <span class="ruby-keyword kw">false</span>
793
+ <span class="ruby-keyword kw">else</span>
794
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">x</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">car</span>(<span class="ruby-identifier">list</span>)
795
+ <span class="ruby-keyword kw">true</span>
796
+ <span class="ruby-keyword kw">else</span>
797
+ <span class="ruby-identifier">member?</span>(<span class="ruby-identifier">x</span>, <span class="ruby-identifier">cdr</span>(<span class="ruby-identifier">list</span>))
798
+ <span class="ruby-keyword kw">end</span>
799
+ <span class="ruby-keyword kw">end</span>
800
+ <span class="ruby-keyword kw">end</span>
801
+ </pre>
802
+ </div>
803
+ </div>
804
+ </div>
805
+
806
+ <div id="method-M000430" class="method-detail">
807
+ <a name="M000430"></a>
808
+
809
+ <div class="method-heading">
810
+ <a href="#M000430" class="method-signature">
811
+ <span class="method-name">null?</span><span class="method-args">(x)</span>
812
+ </a>
813
+ </div>
814
+
815
+ <div class="method-description">
816
+ <p><a class="source-toggle" href="#"
817
+ onclick="toggleCode('M000430-source');return false;">[Source]</a></p>
818
+ <div class="method-source-code" id="M000430-source">
819
+ <pre>
820
+ <span class="ruby-comment cmt"># File lib/carat/lisp.rb, line 152</span>
821
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">null?</span>(<span class="ruby-identifier">x</span>)
822
+ <span class="ruby-identifier">x</span> <span class="ruby-operator">==</span> <span class="ruby-keyword kw">nil</span>
823
+ <span class="ruby-keyword kw">end</span>
824
+ </pre>
825
+ </div>
826
+ </div>
827
+ </div>
828
+
829
+ <div id="method-M000432" class="method-detail">
830
+ <a name="M000432"></a>
831
+
832
+ <div class="method-heading">
833
+ <a href="#M000432" class="method-signature">
834
+ <span class="method-name">pair!</span><span class="method-args">(x)</span>
835
+ </a>
836
+ </div>
837
+
838
+ <div class="method-description">
839
+ <p><a class="source-toggle" href="#"
840
+ onclick="toggleCode('M000432-source');return false;">[Source]</a></p>
841
+ <div class="method-source-code" id="M000432-source">
842
+ <pre>
843
+ <span class="ruby-comment cmt"># File lib/carat/lisp.rb, line 160</span>
844
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">pair!</span>(<span class="ruby-identifier">x</span>)
845
+ <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">x</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">pair?</span>(<span class="ruby-identifier">x</span>)
846
+ <span class="ruby-keyword kw">return</span> <span class="ruby-constant">DottedPair</span>[<span class="ruby-operator">*</span><span class="ruby-identifier">x</span>]
847
+ <span class="ruby-keyword kw">end</span>
848
+ </pre>
849
+ </div>
850
+ </div>
851
+ </div>
852
+
853
+ <div id="method-M000431" class="method-detail">
854
+ <a name="M000431"></a>
855
+
856
+ <div class="method-heading">
857
+ <a href="#M000431" class="method-signature">
858
+ <span class="method-name">pair?</span><span class="method-args">(x)</span>
859
+ </a>
860
+ </div>
861
+
862
+ <div class="method-description">
863
+ <p><a class="source-toggle" href="#"
864
+ onclick="toggleCode('M000431-source');return false;">[Source]</a></p>
865
+ <div class="method-source-code" id="M000431-source">
866
+ <pre>
867
+ <span class="ruby-comment cmt"># File lib/carat/lisp.rb, line 156</span>
868
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">pair?</span>(<span class="ruby-identifier">x</span>)
869
+ <span class="ruby-identifier">x</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">DottedPair</span>)
870
+ <span class="ruby-keyword kw">end</span>
871
+ </pre>
872
+ </div>
873
+ </div>
874
+ </div>
875
+
876
+ <div id="method-M000440" class="method-detail">
877
+ <a name="M000440"></a>
878
+
879
+ <div class="method-heading">
880
+ <a href="#M000440" class="method-signature">
881
+ <span class="method-name">pairlis</span><span class="method-args">(l, m)</span>
882
+ </a>
883
+ </div>
884
+
885
+ <div class="method-description">
886
+ <p><a class="source-toggle" href="#"
887
+ onclick="toggleCode('M000440-source');return false;">[Source]</a></p>
888
+ <div class="method-source-code" id="M000440-source">
889
+ <pre>
890
+ <span class="ruby-comment cmt"># File lib/carat/lisp.rb, line 219</span>
891
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">pairlis</span>(<span class="ruby-identifier">l</span>, <span class="ruby-identifier">m</span>)
892
+ <span class="ruby-identifier">zip</span>(<span class="ruby-identifier">lambda</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">x</span>, <span class="ruby-identifier">y</span><span class="ruby-operator">|</span> <span class="ruby-identifier">cons</span>(<span class="ruby-identifier">x</span>, <span class="ruby-identifier">y</span>) }, <span class="ruby-identifier">l</span>, <span class="ruby-identifier">m</span>)
893
+ <span class="ruby-keyword kw">end</span>
894
+ </pre>
895
+ </div>
896
+ </div>
897
+ </div>
898
+
899
+ <div id="method-M000454" class="method-detail">
900
+ <a name="M000454"></a>
901
+
902
+ <div class="method-heading">
903
+ <a href="#M000454" class="method-signature">
904
+ <span class="method-name">prod</span><span class="method-args">(list)</span>
905
+ </a>
906
+ </div>
907
+
908
+ <div class="method-description">
909
+ <p><a class="source-toggle" href="#"
910
+ onclick="toggleCode('M000454-source');return false;">[Source]</a></p>
911
+ <div class="method-source-code" id="M000454-source">
912
+ <pre>
913
+ <span class="ruby-comment cmt"># File lib/carat/lisp.rb, line 312</span>
914
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">prod</span>(<span class="ruby-identifier">list</span>)
915
+ <span class="ruby-identifier">accumulate</span>(<span class="ruby-identifier">lambda</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">x</span>, <span class="ruby-identifier">y</span><span class="ruby-operator">|</span> <span class="ruby-identifier">x</span> <span class="ruby-operator">*</span> <span class="ruby-identifier">y</span> }, <span class="ruby-value">1</span>, <span class="ruby-identifier">list</span>)
916
+ <span class="ruby-keyword kw">end</span>
917
+ </pre>
918
+ </div>
919
+ </div>
920
+ </div>
921
+
922
+ <div id="method-M000448" class="method-detail">
923
+ <a name="M000448"></a>
924
+
925
+ <div class="method-heading">
926
+ <a href="#M000448" class="method-signature">
927
+ <span class="method-name">reduce</span><span class="method-args">(fun, x, list)</span>
928
+ </a>
929
+ </div>
930
+
931
+ <div class="method-description">
932
+ <p><a class="source-toggle" href="#"
933
+ onclick="toggleCode('M000448-source');return false;">[Source]</a></p>
934
+ <div class="method-source-code" id="M000448-source">
935
+ <pre>
936
+ <span class="ruby-comment cmt"># File lib/carat/lisp.rb, line 286</span>
937
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">reduce</span>(<span class="ruby-identifier">fun</span>, <span class="ruby-identifier">x</span>, <span class="ruby-identifier">list</span>)
938
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">null?</span>(<span class="ruby-identifier">list</span>)
939
+ <span class="ruby-identifier">x</span>
940
+ <span class="ruby-keyword kw">else</span>
941
+ <span class="ruby-identifier">fun</span>.<span class="ruby-identifier">call</span>(<span class="ruby-identifier">car</span>(<span class="ruby-identifier">list</span>), <span class="ruby-identifier">reduce</span>(<span class="ruby-identifier">fun</span>, <span class="ruby-identifier">x</span>, <span class="ruby-identifier">cdr</span>(<span class="ruby-identifier">list</span>)))
942
+ <span class="ruby-keyword kw">end</span>
943
+ <span class="ruby-keyword kw">end</span>
944
+ </pre>
945
+ </div>
946
+ </div>
947
+ </div>
948
+
949
+ <div id="method-M000455" class="method-detail">
950
+ <a name="M000455"></a>
951
+
952
+ <div class="method-heading">
953
+ <a href="#M000455" class="method-signature">
954
+ <span class="method-name">reverse</span><span class="method-args">(lists)</span>
955
+ </a>
956
+ </div>
957
+
958
+ <div class="method-description">
959
+ <p><a class="source-toggle" href="#"
960
+ onclick="toggleCode('M000455-source');return false;">[Source]</a></p>
961
+ <div class="method-source-code" id="M000455-source">
962
+ <pre>
963
+ <span class="ruby-comment cmt"># File lib/carat/lisp.rb, line 316</span>
964
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">reverse</span>(<span class="ruby-identifier">lists</span>)
965
+ <span class="ruby-identifier">accumulate</span>(<span class="ruby-identifier">lambda</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">x</span>, <span class="ruby-identifier">y</span><span class="ruby-operator">|</span> <span class="ruby-identifier">consonto</span>(<span class="ruby-identifier">x</span>, <span class="ruby-identifier">y</span>) }, <span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">lists</span>)
966
+ <span class="ruby-keyword kw">end</span>
967
+ </pre>
968
+ </div>
969
+ </div>
970
+ </div>
971
+
972
+ <div id="method-M000427" class="method-detail">
973
+ <a name="M000427"></a>
974
+
975
+ <div class="method-heading">
976
+ <a href="#M000427" class="method-signature">
977
+ <span class="method-name">set</span><span class="method-args">(var, val, binding)</span>
978
+ </a>
979
+ </div>
980
+
981
+ <div class="method-description">
982
+ <p><a class="source-toggle" href="#"
983
+ onclick="toggleCode('M000427-source');return false;">[Source]</a></p>
984
+ <div class="method-source-code" id="M000427-source">
985
+ <pre>
986
+ <span class="ruby-comment cmt"># File lib/carat/lisp.rb, line 140</span>
987
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">set</span>(<span class="ruby-identifier">var</span>, <span class="ruby-identifier">val</span>, <span class="ruby-identifier">binding</span>)
988
+ <span class="ruby-identifier">eval</span> <span class="ruby-node">&quot;var = #{val}&quot;</span>, <span class="ruby-identifier">binding</span>
989
+ <span class="ruby-keyword kw">end</span>
990
+ </pre>
991
+ </div>
992
+ </div>
993
+ </div>
994
+
995
+ <div id="method-M000428" class="method-detail">
996
+ <a name="M000428"></a>
997
+
998
+ <div class="method-heading">
999
+ <a href="#M000428" class="method-signature">
1000
+ <span class="method-name">set_car!</span><span class="method-args">(pair, val)</span>
1001
+ </a>
1002
+ </div>
1003
+
1004
+ <div class="method-description">
1005
+ <p><a class="source-toggle" href="#"
1006
+ onclick="toggleCode('M000428-source');return false;">[Source]</a></p>
1007
+ <div class="method-source-code" id="M000428-source">
1008
+ <pre>
1009
+ <span class="ruby-comment cmt"># File lib/carat/lisp.rb, line 144</span>
1010
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">set_car!</span>(<span class="ruby-identifier">pair</span>, <span class="ruby-identifier">val</span>)
1011
+ <span class="ruby-identifier">pair</span>.<span class="ruby-identifier">first</span> = <span class="ruby-identifier">val</span>
1012
+ <span class="ruby-keyword kw">end</span>
1013
+ </pre>
1014
+ </div>
1015
+ </div>
1016
+ </div>
1017
+
1018
+ <div id="method-M000429" class="method-detail">
1019
+ <a name="M000429"></a>
1020
+
1021
+ <div class="method-heading">
1022
+ <a href="#M000429" class="method-signature">
1023
+ <span class="method-name">set_cdr!</span><span class="method-args">(pair, val)</span>
1024
+ </a>
1025
+ </div>
1026
+
1027
+ <div class="method-description">
1028
+ <p><a class="source-toggle" href="#"
1029
+ onclick="toggleCode('M000429-source');return false;">[Source]</a></p>
1030
+ <div class="method-source-code" id="M000429-source">
1031
+ <pre>
1032
+ <span class="ruby-comment cmt"># File lib/carat/lisp.rb, line 148</span>
1033
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">set_cdr!</span>(<span class="ruby-identifier">pair</span>, <span class="ruby-identifier">val</span>)
1034
+ <span class="ruby-identifier">pair</span>.<span class="ruby-identifier">second</span> = <span class="ruby-identifier">val</span>
1035
+ <span class="ruby-keyword kw">end</span>
1036
+ </pre>
1037
+ </div>
1038
+ </div>
1039
+ </div>
1040
+
1041
+ <div id="method-M000453" class="method-detail">
1042
+ <a name="M000453"></a>
1043
+
1044
+ <div class="method-heading">
1045
+ <a href="#M000453" class="method-signature">
1046
+ <span class="method-name">sum</span><span class="method-args">(list)</span>
1047
+ </a>
1048
+ </div>
1049
+
1050
+ <div class="method-description">
1051
+ <p><a class="source-toggle" href="#"
1052
+ onclick="toggleCode('M000453-source');return false;">[Source]</a></p>
1053
+ <div class="method-source-code" id="M000453-source">
1054
+ <pre>
1055
+ <span class="ruby-comment cmt"># File lib/carat/lisp.rb, line 308</span>
1056
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">sum</span>(<span class="ruby-identifier">list</span>)
1057
+ <span class="ruby-identifier">accumulate</span>(<span class="ruby-identifier">lambda</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">x</span>, <span class="ruby-identifier">y</span><span class="ruby-operator">|</span> <span class="ruby-identifier">x</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">y</span> }, <span class="ruby-value">0</span>, <span class="ruby-identifier">list</span>)
1058
+ <span class="ruby-keyword kw">end</span>
1059
+ </pre>
1060
+ </div>
1061
+ </div>
1062
+ </div>
1063
+
1064
+ <div id="method-M000456" class="method-detail">
1065
+ <a name="M000456"></a>
1066
+
1067
+ <div class="method-heading">
1068
+ <a href="#M000456" class="method-signature">
1069
+ <span class="method-name">take</span><span class="method-args">(l, n)</span>
1070
+ </a>
1071
+ </div>
1072
+
1073
+ <div class="method-description">
1074
+ <p><a class="source-toggle" href="#"
1075
+ onclick="toggleCode('M000456-source');return false;">[Source]</a></p>
1076
+ <div class="method-source-code" id="M000456-source">
1077
+ <pre>
1078
+ <span class="ruby-comment cmt"># File lib/carat/lisp.rb, line 320</span>
1079
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">take</span>(<span class="ruby-identifier">l</span>, <span class="ruby-identifier">n</span>)
1080
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">n</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">0</span> <span class="ruby-keyword kw">and</span> <span class="ruby-keyword kw">not</span> <span class="ruby-identifier">null?</span>(<span class="ruby-identifier">l</span>)
1081
+ <span class="ruby-identifier">cons</span>(<span class="ruby-identifier">car</span>(<span class="ruby-identifier">l</span>), <span class="ruby-identifier">take</span>(<span class="ruby-identifier">cdr</span>(<span class="ruby-identifier">l</span>), <span class="ruby-identifier">n</span> <span class="ruby-operator">-</span> <span class="ruby-value">1</span>))
1082
+ <span class="ruby-keyword kw">else</span>
1083
+ <span class="ruby-keyword kw">nil</span>
1084
+ <span class="ruby-keyword kw">end</span>
1085
+ <span class="ruby-keyword kw">end</span>
1086
+ </pre>
1087
+ </div>
1088
+ </div>
1089
+ </div>
1090
+
1091
+ <div id="method-M000439" class="method-detail">
1092
+ <a name="M000439"></a>
1093
+
1094
+ <div class="method-heading">
1095
+ <a href="#M000439" class="method-signature">
1096
+ <span class="method-name">zip</span><span class="method-args">(fun, l, m)</span>
1097
+ </a>
1098
+ </div>
1099
+
1100
+ <div class="method-description">
1101
+ <p><a class="source-toggle" href="#"
1102
+ onclick="toggleCode('M000439-source');return false;">[Source]</a></p>
1103
+ <div class="method-source-code" id="M000439-source">
1104
+ <pre>
1105
+ <span class="ruby-comment cmt"># File lib/carat/lisp.rb, line 209</span>
1106
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">zip</span>(<span class="ruby-identifier">fun</span>, <span class="ruby-identifier">l</span>, <span class="ruby-identifier">m</span>)
1107
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">null?</span>(<span class="ruby-identifier">l</span>) <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">null?</span>(<span class="ruby-identifier">m</span>)
1108
+ <span class="ruby-keyword kw">nil</span>
1109
+ <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">null?</span>(<span class="ruby-identifier">l</span>) <span class="ruby-keyword kw">or</span> <span class="ruby-identifier">null?</span>(<span class="ruby-identifier">m</span>)
1110
+ <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">&quot;zip with unequal length lists&quot;</span>)
1111
+ <span class="ruby-keyword kw">else</span>
1112
+ <span class="ruby-identifier">cons</span>(<span class="ruby-identifier">fun</span>.<span class="ruby-identifier">call</span>(<span class="ruby-identifier">car</span>(<span class="ruby-identifier">l</span>), <span class="ruby-identifier">car</span>(<span class="ruby-identifier">m</span>)), <span class="ruby-identifier">zip</span>(<span class="ruby-identifier">fun</span>, <span class="ruby-identifier">cdr</span>(<span class="ruby-identifier">l</span>), <span class="ruby-identifier">cdr</span>(<span class="ruby-identifier">m</span>)))
1113
+ <span class="ruby-keyword kw">end</span>
1114
+ <span class="ruby-keyword kw">end</span>
1115
+ </pre>
1116
+ </div>
1117
+ </div>
1118
+ </div>
1119
+
1120
+
1121
+ </div>
1122
+
1123
+
1124
+ </div>
1125
+
1126
+
1127
+ <div id="validator-badges">
1128
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
1129
+ </div>
1130
+
1131
+ </body>
1132
+ </html>