/help/arc.arc

http://github.com/alimoeeny/arc · Unknown · 987 lines · 746 code · 241 blank · 0 comment · 0 complexity · 06835b06e8e923f39b71ed5e8292048a MD5 · raw file

  1. (mac doclist args
  2. `(= ,@(mappend (fn ((name doc)) `((help* ',name) ,doc))
  3. (pair args))))
  4. ; TODO: defs union addtem since {minutes,hours,days}-since defcache only
  5. ; positive len< len> or= hook defhook out fromdisk diskvar disktable todisk
  6. (doclist
  7. do
  8. " Evaluates each expression in sequence and returns the result of the
  9. last expression.
  10. See also [[do1]] [[after]] "
  11. def
  12. " Defines a function with the given `name', `parms', and `body'.
  13. See also [[fn]] [[mac]] "
  14. caar " Equivalent to (car (car xs)) "
  15. cadr " Equivalent to (car (cdr xs)) "
  16. cddr " Equivalent to (cdr (cdr xs)) "
  17. no " Returns `t' iff `x' is `nil'. "
  18. acons
  19. " Determines if `x' is a `cons' cell or list.
  20. Unlike 'alist, this function will return nil if given an empty list
  21. See also [[atom]] [[alist]] [[dotted]] [[isa]] [[cons]] [[list]] "
  22. atom
  23. " Determines if `x' is atomic.
  24. See also [[acons]] [[isa]] "
  25. copylist
  26. " Makes a shallow copy of the list `xs'.
  27. See also [[list]] [[cons]] "
  28. list
  29. " Creates a list from the given parameters.
  30. See also [[cons]] [[acons]] [[copylist]] "
  31. idfn " Returns `x'; the identity function. "
  32. map1
  33. " Return a sequence with function f applied to every element in sequence xs.
  34. See also [[map]] [[each]] [[mappend]] [[andmap]] [[ormap]] "
  35. pair
  36. " Applies pairs of elements to the function `f'.
  37. See also [[tuples]] [[map]] "
  38. mac
  39. " Defines a macro, a special function which transforms code.
  40. See also [[def]] "
  41. and
  42. " Evaluates arguments till false is found else returns the last one.
  43. See also [[or]] [[aand]] [[andf]] [[nor]] "
  44. assoc
  45. " Finds a (key value) pair in an associated list.
  46. See also [[alref]] [[listtab]] [[tablist]] "
  47. alref
  48. " Get a value from a key in a associated list.
  49. See also [[assoc]] [[listtab]] [[tablist]] "
  50. with
  51. " Assigns a set of local variables for the given `body'.
  52. Assignment is simultaneous.
  53. See also [[withs]] [[let]] [[fn]] [[do]] "
  54. let
  55. " Assigns a local variable for the given `body'.
  56. See also [[with]] [[withs]] [[fn]] [[do]] "
  57. withs
  58. " Assigns local variables for the given `body'.
  59. The assignments are made in the given order.
  60. See also [[with]] [[let]] [[fn]] [[do]] "
  61. join
  62. " Joins all list arguments together.
  63. See also [[cons]] [[+]] "
  64. rfn
  65. " Creates a function which calls itself as `name'.
  66. See also [[fn]] [[afn]] "
  67. afn
  68. " Creates a function which calls itself with the name `self'.
  69. See also [[fn]] [[rfn]] [[aif]] [[awhen]] [[aand]] "
  70. compose
  71. " Function composition; eg. ((compose x y z) a b c) == (x (y (z a b c)))
  72. Composes in functional position are transformed away by ac.
  73. Arc expands x:y:z into (compose x y z)
  74. See also [[complement]] "
  75. complement
  76. " Function complement; eg. ((complement f) a b) == (no (f a b))
  77. Complements in functional position are transformed away by ac.
  78. Arc expands ~x into (complement x)
  79. See also [[compose]] "
  80. rev
  81. " Reverses a copy of the list `xs'
  82. See also [[copy]] [[copylist]] "
  83. isnt
  84. " Inverse of is.
  85. See also [[no]] [[is]] "
  86. w/uniq
  87. " Assigns a set of variables to unique symbols.
  88. Generally used in macros.
  89. See also [[uniq]] "
  90. or
  91. " Computes arguments until one of them is true and returns that result.
  92. See also [[and]] [[orf]] [[nor]] [[check]] "
  93. alist
  94. " Return true if argument is a possibly empty list
  95. Unlike 'acons, this function returns t when given an empty list
  96. See also [[atom]] [[acons]] [[dotted]] [[isa]] [[cons]] [[list]] "
  97. in
  98. " Returns true if the first argument is one of the other arguments.
  99. See also [[some]] [[mem]] "
  100. iso
  101. " Isomorphic compare - compares structure (can be slow).
  102. See also [[is]] "
  103. when
  104. " When `test' is true, do `body'.
  105. See also [[unless]] [[if]] [[awhen]] "
  106. unless
  107. " When `test' is not true, do `body'.
  108. See also [[when]] [[if]] [[no]] "
  109. while
  110. " While `test' is true, perform `body' in a loop.
  111. See also [[until]] [[loop]] [[whilet]] [[whiler]] [[for]]
  112. [[repeat]] [[drain]] "
  113. empty
  114. " Test to see if `seq' is an empty list or other sequence.
  115. See also [[no]] [[acons]] [[len]] "
  116. reclist
  117. " Applies the function `f' on the sublists of `xs' until `f' returns true.
  118. See also [[map]] "
  119. recstring
  120. " Applies the function `test' on indices of `s' until `test' returns true.
  121. See also [[map]] [[reclist]] "
  122. testify
  123. " Turns `x' into a test. Functions are returned unchanged. Otherwise, returns
  124. a function that tests whether its argument is `x'.
  125. See also [[is]] "
  126. some
  127. " Determines if at least one element of `seq' satisfies `test'.
  128. See also [[all]] [[mem]] [[in]] [[pos]] [[testify]] "
  129. all
  130. " Determines if all elements of `seq' satisfy `test'.
  131. See also [[some]] [[testify]] "
  132. mem
  133. " Returns the sublist of `seq' whose first element satisfies `test'.
  134. See also [[find]] [[some]] [[in]] [[testify]] "
  135. find
  136. " Returns the first element of `seq' that satisfies `test'.
  137. See also [[mem]] [[some]] [[in]] [[testify]] "
  138. isa
  139. " Checks if x is of type y.
  140. See also [[acons]] [[alist]] [[atom]] "
  141. map
  142. " Applies the elements of the sequences to the given function.
  143. Returns a sequence containing the results of the function.
  144. See also [[each]] [[map1]] [[mappend]] [[reduce]] "
  145. mappend
  146. " Applies the elements of the sequences to the given function.
  147. Returns a sequence containing the concatenation of the results
  148. of the function.
  149. See also [[map]] [[join]] "
  150. firstn
  151. " Returns the first `n' elements of the given list `xs'.
  152. See also [[cut]] [[nthcdr]] [[retrieve]] "
  153. nthcdr
  154. " Returns the sublist of `xs' starting on the `n'th element.
  155. `n' is 0-based.
  156. See also [[cut]] [[firstn]] "
  157. tuples
  158. " Returns a list of lists of the elements of `xs', grouped by `n'.
  159. See also [[pair]] "
  160. caris
  161. " Determines if (car x) is `val'.
  162. See also [[is]] [[car]] [[carif]] "
  163. warn
  164. " Displays a warning message on its arguments.
  165. See also [[ero]] [[pr]] "
  166. atomic
  167. " Performs `body' atomically, blocking other threads.
  168. See also [[atlet]] [[atwith]] [[atwiths]] "
  169. atlet
  170. " Performs a `let' atomically, blocking other threads.
  171. See also [[atomic]] [[atwith]] [[atwiths]] "
  172. atwith
  173. " Performs a `with' atomically, blocking other threads.
  174. See also [[atomic]] [[atlet]] [[atwiths]] "
  175. atwiths
  176. " Performs a `withs' atomically, blocking other threads.
  177. See also [[atomic]] [[atlet]] [[atwith]] "
  178. defset
  179. " Defines a setter for the named form.
  180. See also [[=]] "
  181. =
  182. " Assigns values to variables.
  183. See also [[set]] [[wipe]] [[++]] [[--]] [[rotate]] [[defset]] "
  184. loop
  185. " First performs `start'; while `test' is true, performs `body' then
  186. `update' in a loop.
  187. See also [[while]] "
  188. for
  189. " Loops for the variable `v' from `init' to `max'.
  190. See also [[repeat]] [[forlen]] "
  191. repeat
  192. " Repeats the `body' `n' times.
  193. See also [[for]] [[forlen]] [[n-of]] "
  194. walk
  195. " Calls `func' on each element of `seq' for side-effects.
  196. See also [[map]] [[each]] "
  197. each
  198. " Performs `body' for each element of the sequence returned by `expr',
  199. with each element assigned to `var'.
  200. See also [[walk]] [[forlen]] [[on]] [[map]] [[ontable]] "
  201. cut
  202. " Returns a subsequence of the given `seq'. If `end' is negative,
  203. it's a 0-based index from the end of the string. For example,
  204. arc> (cut \"abcde\" 1, -1)
  205. \"bcd\"
  206. See also [[firstn]] [[nthcdr]] [[split]] "
  207. whilet
  208. " While `test' is true, perform `body' in a loop.
  209. The result of `test' is assigned to `var'.
  210. See also [[while]] [[whiler]] [[drain]] "
  211. last " Returns the last element of `seq'. "
  212. rem
  213. " Returns a copy of `seq' with elements that pass `test' removed.
  214. See also [[keep]] [[pull]] "
  215. keep
  216. " Returns a copy of `seq' with elements that fail `test' removed.
  217. See also [[rem]] [[pull]] [[trues]] "
  218. trues
  219. " Returns (map f xs) sans nils.
  220. See also [[rem]] [[keep]] "
  221. do1
  222. " Performs the body in sequence, then returns the value of the
  223. first expression.
  224. See also [[do]] "
  225. caselet
  226. " Matches the result of `expr' to arguments until one matches.
  227. The result of `expr' is assigned to `var'.
  228. See also [[case]] [[if]] [[iflet]] "
  229. case
  230. " Matches the result of `expr' to arguments until one matches.
  231. See also [[caselet]] [[if]] "
  232. push
  233. " Pushes the value `x' on the front of the list in `place'.
  234. See also [[pop]] [[cons]] "
  235. swap
  236. " Swaps the values of the specified places.
  237. See also [[rotate]] [[=]] "
  238. rotate
  239. " Rotates the values of the specified places, from right to left.
  240. See also [[swap]] [[=]] "
  241. pop
  242. " Pops a value from the front of the list in `place'.
  243. See also [[push]] [[car]] "
  244. adjoin
  245. " Returns a list with `x' in front of `xs', unless `test' returns true
  246. for some element of `xs' when matched with `x'.
  247. See also [[cons]] [[pushnew]] [[consif]] "
  248. pushnew
  249. " Pushes `x' into the front of the list in `place' unless it is
  250. already in that list.
  251. See also [[push]] [[adjoin]] [[cons]] [[consif]] "
  252. pull
  253. " Removes all elements that pass `test' from the list in `place'.
  254. See also [[rem]] [[keep]] "
  255. ++
  256. " Increments `place' by the given increment `i' (defaults to 1).
  257. See also [[--]] [[zap]] [[=]] "
  258. --
  259. " Decrements `place' by the given decrement `i' (defaults to 1).
  260. See also [[++]] [[zap]] [[=]] "
  261. zap
  262. " Modifies `place' with the result of `op' on that `place'.
  263. See also [[++]] [[--]] [[pull]] [[push]] [[pop]] [[=]]
  264. [[set]] [[wipe]] "
  265. pr
  266. " Prints the arguments.
  267. See also [[prn]] [[warn]] [[ero]] "
  268. prn
  269. " Prints the arguments followed by a newline.
  270. See also [[pr]] [[warn]] [[ero]] "
  271. wipe
  272. " Sets each of the given places to nil.
  273. See also [[set]] [[zap]] [[=]] "
  274. set
  275. " Sets each of the given places to t.
  276. See also [[wipe]] [[zap]] [[=]] "
  277. iflet
  278. " Checks if `expr' is true, and if so, assigns it to `var' and
  279. performs the `then' clause.
  280. See also [[caselet]] [[whenlet]] [[if]] "
  281. whenlet
  282. " Checks if `expr' is true, and if so, assigns it to `var' and
  283. performs the `body'.
  284. See also [[caselet]] [[iflet]] [[when]] [[if]] "
  285. aif
  286. " Similar to `if' but assigns the result of 'expr' to the variable `it'.
  287. See also [[if]] [[awhen]] [[aand]] [[afn]] "
  288. awhen
  289. " Similar to `when' but assigns the result of 'expr' to the variable `it'.
  290. See also [[when]] [[aif]] [[aand]] [[afn]] "
  291. aand
  292. " Similar to `and' but assigns the previous expression to the variable `it'.
  293. See also [[and]] [[aif]] [[awhen]] [[afn]] "
  294. accum
  295. " Collects or accumulates the values given to all calls to `accfn' within
  296. `body' and returns a list of those values. Order is preserved.
  297. See also [[summing]] "
  298. drain
  299. " Repeatedly evaluates `expr' until it returns nil, then returns a list
  300. of the true values.
  301. See also [[while]] [[whiler]] [[whilet]] "
  302. whiler
  303. " Performs `body' while `expr' is not `endval', assigning the result of
  304. `expr' to `var'.
  305. See also [[while]] [[whilet]] [[drain]] "
  306. consif
  307. " Adds `x' to the front of the list `y' if `x' is true.
  308. See also [[cons]] [[if]] [[adjoin]] [[conswhen]] "
  309. string
  310. " Creates a string from its arguments
  311. See also [[sym]] "
  312. flat
  313. " Flattens a nested list.
  314. See also [[list]] "
  315. check
  316. " Returns `x' if it passes `test', otherwise returns `alt'.
  317. See also [[or]] "
  318. pos
  319. " Returns the position of the first element in `seq' that passes `test'.
  320. See also [[some]] "
  321. even
  322. " Determines if a number is even. See also [[odd]] "
  323. odd
  324. " Determines if a number is odd. See also [[even]] "
  325. after
  326. " Ensures that the body is performed after the expression `x',
  327. even if it fails.
  328. See also [[do]]"
  329. w/infile
  330. " Opens the given file `name' for input, assigning the stream to `var'.
  331. The stream is automatically closed on exit from the `body'.
  332. See also [[w/outfile]] [[w/instring]] [[w/stdin]] [[w/socket]] "
  333. w/outfile
  334. " Opens the given file `name' for output, assigning the stream to `var'.
  335. The stream is automatically closed on exit from the `body'.
  336. See also [[w/infile]] [[w/appendfile]] [[w/outstring]] [[w/stdout]] "
  337. w/instring
  338. " Opens the given string `str' for input, assigning the stream to `var'.
  339. The stream is automatically closed on exit from the `body'.
  340. See also [[w/outstring]] [[fromstring]] [[w/infile]] [[w/stdin]]
  341. [[w/socket]] "
  342. w/socket
  343. " Opens the port for listening, assigning the stream to `var'.
  344. The stream is automatically closed on exit from the `body'.
  345. See also [[w/infile]] [[w/instring]] [[w/stdin]] "
  346. w/outstring
  347. " Opens a string for output, assigning the stream to `var'.
  348. The stream is automatically closed on exit from the `body'.
  349. The contents of the string can be accessed via (inside `var')
  350. See also [[w/instring]] [[tostring]] [[w/outfile]] [[w/stdout]] "
  351. w/appendfile
  352. " Opens a file `name' for append, assigning the stream to `var'.
  353. The stream is automatically closed on exit from the `body'.
  354. See also [[w/outfile]] [[w/infile]] "
  355. w/stdout
  356. " Opens the stream `str' for output; normal printed output from `body'
  357. is redirected to the stream.
  358. See also [[w/stdin]] [[w/outfile]] [[w/outstring]] "
  359. w/stdin
  360. " Opens the stream `str' for input; normal read input from `body'
  361. is redirected from the stream.
  362. See also [[w/stdout]] [[w/infile]] [[w/instring]] [[w/socket]] "
  363. tostring
  364. " Returns the printed standard output from `body' as a string.
  365. See also [[fromstring]] [[w/stdout]] [[w/outstring]] "
  366. fromstring
  367. " Redirects read standard input to `body' from the given string `str'.
  368. See also [[tostring]] [[w/stdin]] [[w/instring]] "
  369. readstring1
  370. " Reads a single expression from the string.
  371. See also [[read]] "
  372. read
  373. " Reads a single expression from a string or stream.
  374. See also [[readstring1]] [[readfile]] [[readfile1]] [[readall]] "
  375. readfile
  376. " Reads the expressions from the file `name', and returns a list of
  377. expressions read from the file.
  378. See also [[read]] "
  379. readfile1
  380. " Reads a single expression from the file `name'.
  381. See also [[read]] "
  382. readall
  383. " Reads the expressions from the string or stream `src', and returns a
  384. list of expressions read from the file.
  385. See also [[read]] "
  386. writefile
  387. " Writes the value to the file `name'.
  388. See also [[writefileraw]] "
  389. sym
  390. " Returns the symbol for `x'.
  391. See also [[string]] "
  392. int " Interprets `x' as a base-`b' integer. "
  393. rand-choice
  394. " Returns the result of one of the given `exprs', chosen at random.
  395. See also [[random-elt]] "
  396. n-of
  397. " Repeats `expr' `n' times, then returns the results in a list.
  398. See also [[repeat]] "
  399. rand-string
  400. " Generates a random string of letters and numbers. "
  401. forlen
  402. " Loops across the length of the sequence `s'.
  403. See also [[repeat]] [[each]] [[on]] "
  404. on
  405. " Loops across the sequence `s', assigning each element to `var',
  406. and providing the current index in `index'.
  407. See also [[each]] [[forlen]] "
  408. best
  409. " Selects the best element of `seq' according to `f'.
  410. `f' is a comparison function between elements of `seq'.
  411. See also [[max]] [[most]] "
  412. max
  413. " Returns the highest argument.
  414. See also [[min]] [[best]] [[most]] "
  415. min
  416. " Returns the lowest argument.
  417. See also [[max]] [[best]] [[most]] "
  418. most
  419. " Selects the element of `seq' with the highest [f _].
  420. `f' is a score function for elements of `seq'.
  421. See also [[best]] [[least]] "
  422. insert-sorted
  423. " Inserts `elt' into a sequence `seq' sorted by `test'.
  424. See also [[sort]] [[insort]] [[reinsert-sorted]] "
  425. insort
  426. " Inserts `elt' into a sequence in the place `seq' sorted by `test'.
  427. See also [[insert-sorted]] [[sort]] "
  428. reinsert-sorted
  429. " Inserts `elt' into a sequence `seq', partially sorted by `test'.
  430. See also [[insert-sorted]] [[insortnew]] [[sort]] "
  431. insortnew
  432. " Inserts `elt' into a sequence in the place `seq', partially sorted
  433. by `test'.
  434. See also [[reinsert-sorted]] [[sort]] "
  435. memo
  436. " Creates a function that will store results of calls to the given
  437. source function.
  438. For each set of arguments, the source function will only be called
  439. once; if the memo'ed function is called again with the same arguments,
  440. it will return the stored result instead of calling the source function.
  441. See also [[defmemo]] "
  442. defmemo
  443. " Defines a function that automatically stores the results of calls.
  444. For each set of arguments, this function will only execute once.
  445. If the function is called again with the same arguments, it will
  446. immediately return the stored result for that set of arguments.
  447. See also [[memo]] "
  448. <=
  449. " Determines if each argument is less than or equal to succeeding
  450. arguments. "
  451. >=
  452. " Determines if each argument is greater than or equal to succeeding
  453. arguments. "
  454. whitec
  455. " Determines if the given `c' is a whitespace character.
  456. See also [[alphadig]] [[nonwhite]] [[punc]] "
  457. nonwhite
  458. " Determines if the given `c' is not a whitespace character.
  459. See also [[whitec]] [[alphadig]] [[punc]] "
  460. letter
  461. " True iff the given character `c' is a letter.
  462. See also [[alphadig]] [[digit]] "
  463. digit
  464. " True iff the given character `c' is a digit.
  465. See also [[alphadig]] [[letter]] "
  466. alphadig
  467. " Determines if the given `c' is an alphanumeric character.
  468. See also [[letter]] [[digit]] [[whitec]] [[nonwhite]] [[punc]] "
  469. punc
  470. " Determines if the given `c' is punctuation character.
  471. See also [[whitec]] [[nonwhite]] [[alphadig]] [[punc]] "
  472. readline
  473. " Reads a string terminated by a newline from the stream `str'. "
  474. summing
  475. " Counts the number of times `sumfn' is called with a true value
  476. within `body'.
  477. See also [[accum]] "
  478. sum
  479. " Sums (map f xs).
  480. See also [[map]] [[reduce]] [[summing]] "
  481. treewise
  482. " Folds across `tree' as a binary tree, calling `base' on atoms (leafs) and
  483. calling `f' on the results of recursion across the car and the cdr of conses
  484. (internal nodes).
  485. See also [[trav]] [[tree-subst]] [[ontree]] "
  486. carif
  487. " Returns the first element of a list if the argument is a list.
  488. See also [[car]] [[caris]] "
  489. prall
  490. " Prints several arguments with an initial header and separated by a
  491. given separator.
  492. See also [[prs]] "
  493. prs
  494. " Prints several arguments separated by spaces.
  495. See also [[prall]] "
  496. tree-subst
  497. " Replaces an element of a list with that list treated as a binary tree.
  498. See also [[treewise]] [[trav]] "
  499. ontree
  500. " Applies `f' (for side effects) to each node of the binary tree `tree'.
  501. A binary tree is eiher an atom or a cons of two binary trees.
  502. See also [[treewise]] [[trav]] "
  503. dotted
  504. " Determines if `x' is a dotted cons pair.
  505. See also [[acons]] [[alist]] "
  506. fill-table
  507. " Fills `table' with key-value pairs in the `data' list.
  508. See also [[table]] "
  509. keys
  510. " Returns a list of keys in the table or object `h'.
  511. See also [[vals]] [[table]] "
  512. vals
  513. " Returns a list of values in the table or object `h'.
  514. See also [[keys]] [[table]] "
  515. tablist
  516. " Transforms a table or object `h' into an association list.
  517. See also [[listtab]] [[alref]] [[assoc]] "
  518. listtab
  519. " Transforms an association list into a table or object.
  520. See also [[tablist]] [[alref]] [[assoc]] "
  521. obj
  522. " Creates an object with the specified entries.
  523. See also [[inst]] [[table]] "
  524. load-table
  525. " Loads an association list from `file' into a table or object.
  526. See also [[load-tables]] [[read-table]] [[save-table]] [[listtab]] "
  527. read-table
  528. " Loads an association list from the stream `i' into a table or object.
  529. See also [[load-tables]] [[load-table]] [[write-table]] [[listtab]] "
  530. load-tables
  531. " Loads several association lists from `file' into a list of tables or
  532. objects.
  533. See also [[load-table]] [[read-table]] "
  534. save-table
  535. " Writes a table or object `h' to `file'.
  536. See also [[write-table]] [[load-table]] [[tablist]] "
  537. write-table
  538. " Writes a table or object `h' to the stream `o'.
  539. See also [[save-table]] [[read-table]] [[tablist]] "
  540. copy
  541. " Creates a copy of an existing argument `x'.
  542. See also [[rev]] "
  543. abs " Returns the absolute value of a number. "
  544. round
  545. " Rounds off a fractional value to the nearest whole number.
  546. See also [[roundup]] [[to-nearest]] "
  547. roundup
  548. " Rounds off a fractional value to the nearest absolute highest
  549. whole number.
  550. See also [[round]] [[to-nearest]] "
  551. nearest
  552. " Rounds off `n' to the nearest multiple of `quantum'.
  553. See also [[round]] [[roundup]] "
  554. avg
  555. " Averages all numbers in `ns'. See also [[med]] "
  556. med
  557. " Computes the median of `ns' according to the comparison `test'.
  558. See also [[avg]] "
  559. sort " Sorts `seq' according to `test'. See also [[mergesort]] "
  560. mergesort
  561. " Sorts a list `lst' according to `less?'. See also [[merge]] [[sort]] "
  562. merge " Merges two sorted lists by `less?'. See also [[mergesort]] "
  563. bestn
  564. " Returns a list of the best `n' elements of seq according to
  565. the comparison function `f'.
  566. See also [[best]] "
  567. split
  568. " Splits `seq' at offset `pos', returning a two-element list of the
  569. split.
  570. See also [[cut]] "
  571. time
  572. " Prints the time consumed by evaluating `expr', returning the result.
  573. See also [[jtime]] [[time10]] "
  574. jtime
  575. " Prints the time consumed by `expr', returning `ok' when the
  576. expression completes.
  577. See also [[time]] [[time10]] "
  578. time10
  579. " Prints the time consumed by executing `expr' 10 times.
  580. See also [[time]] [[jtime]] "
  581. deftem
  582. " Defines an object template for field values, with inclusion for
  583. existing templates.
  584. See also [[inst]] [[templatize]] [[temread]] [[temload]] [[temloadall]] "
  585. inst
  586. " Creates an object instantiating a given template.
  587. See also [[deftem]] [[templatize]] [[temread]] [[temload]] [[temloadall]] "
  588. temread
  589. " Reads an association list from the stream `str' and creates an
  590. object instantiating the given template containing the data in
  591. the association list.
  592. See also [[deftem]] [[inst]] [[templatize]] [[temload]] [[temloadall]] "
  593. templatize
  594. " Creates an object instantiating a given template containing the
  595. data in the association list `raw'.
  596. See also [[deftem]] [[inst]] [[temread]] [[temload]] [[temloadall]] "
  597. temload
  598. " Reads an association list from `file' and creates an object
  599. instantiating the given template containing the data in the
  600. association list.
  601. See also [[deftem]] [[inst]] [[templatize]] [[temread]] [[temloadall]] "
  602. temloadall
  603. " Reads all association lists from `file' and creates a list
  604. of objects instantiating the given template containing the
  605. data in each association list.
  606. See also [[deftem]] [[inst]] [[templatize]] [[temread]] [[temload]]"
  607. number
  608. " Determines if `n' is a number. "
  609. ; TODO: better description for 'cache
  610. cache
  611. " Caches the result of a call to `valf' until a number of seconds
  612. greater than the result of a call to `timef' have passed. "
  613. errsafe
  614. " Executes `expr' and blocks any errors "
  615. saferead
  616. " Reads an expression, blocking any errors. "
  617. safe-load-table
  618. " Loads a table from `filename', blocking any errors. "
  619. ensure-dir
  620. " Ensures that the specified directory exists, and creates it if not
  621. yet created. "
  622. date " Returns the date as a triple of numbers: (year month day). "
  623. datestring " Returns the date as a string in YYYY-MM-DD format."
  624. count " Counts the number of elements in `x' which pass `test'. "
  625. ellipsize
  626. " Trims a string `str' with `...' if it is longer than the given `limit'. "
  627. rand-elt
  628. " Returns an element of `seq' chosen by random. See also [[rand-choice]] "
  629. until
  630. " While `test' is false, perform `body' in a loop.
  631. See also [[while]] "
  632. before " Determines if `x' exists before `y' in `seq'. "
  633. orf
  634. " Creates a function which returns true on its argument if any of the
  635. given `fns' return true on that argument.
  636. See also [[andf]] "
  637. andf
  638. " Creates a function which returns true on its argument if all of the
  639. given `fns' return true on that argument.
  640. See also [[orf]] "
  641. atend
  642. " Determines if the index `i' is at or beyond the end of the sequence `s'. "
  643. multiple " Determines if `x' is a multiple of `y'. "
  644. nor
  645. " Computes arguments until one of them returns true, then returns nil,
  646. or else returns true.
  647. See also [[and]] [[or]] "
  648. compare
  649. " Creates a function that compares using `comparer' the result of `scorer'
  650. on its arguments. "
  651. conswhen
  652. " Adds `x' to the front of `y' if `x' passes the test `f'.
  653. See also [[consif]] [[adjoin]] "
  654. retrieve
  655. " Returns the first `n' elements of `xs' which pass `f'.
  656. See also [[firstn]] [[keep]] "
  657. dedup " Returns `xs' sans duplicates. "
  658. single " Determines if `x' is a list with only one element. "
  659. intersperse " Inserts `x' between elements of `ys'. "
  660. counts
  661. " Returns a table with elements of `seq' as keys and the number of
  662. occurences of that element as values. "
  663. commonest
  664. " Returns a two-element list containing the most common element of
  665. `seq' and the number of times it occured in the sequence. "
  666. reduce
  667. " Applies `f' to an accumulated result on the elements of `xs'.
  668. Elements are processed left-to-right.
  669. `f' is applied to at most 2 elements at a time.
  670. See also [[rreduce]]
  671. "
  672. rreduce
  673. " Applies `f' to an accumulated result on the elements of `xs'
  674. Elements are processed right-to-left.
  675. `f' is applied to at most 2 elements at a time.
  676. See also [[reduce]] "
  677. parse-format
  678. " Parses a simple ~-format string. "
  679. prf
  680. " Prints according to a format string, replacing ~* with arguments. "
  681. load
  682. " Reads the expressions in `file' and evaluates them. "
  683. w/table " Creates a table assigned to `var' for use in `body'. "
  684. ero " Outputs `args' to stderr. "
  685. queue
  686. " Creates a queue.
  687. See also [[enq]] [[deq]] [[qlen]] [[qlist]] [[enq-limit]]"
  688. enq " Adds `obj' to a queue. See also [[queue]] "
  689. deq " Removes and returns an item from a queue. See also [[queue]] "
  690. qlen " Returns the number of items in a queue. See also [[queue]] "
  691. qlist " Returns the queue contents as a list. See also [[queue]] "
  692. enq-limit
  693. " Adds an item to the queue; removes a queue item if `limit' is
  694. exceeded. See also [[queue]] "
  695. median " Computes the median of an unsorted list. "
  696. noisy-each
  697. " Performs `body' for each element of the sequence returned by `val',
  698. with each element assigned to `var'; prints a `.' every `n' elements. "
  699. point
  700. " Creates a form which may be exited by calling `name' from within `body'.
  701. See also [[catch]] "
  702. catch
  703. " Catches any value returned by `throw' within `body'.
  704. See also [[point]] "
  705. downcase
  706. " Converts `x' to lowercase, if a character, string, or symbol;
  707. otherwise, raises an error.
  708. See also [[upcase]] "
  709. upcase
  710. " Converts `x' to uppercase, if a character, string, or symbol;
  711. otherwise, raises an error.
  712. See also [[downcase]] "
  713. range "Return a range of numbers from `start' to `end', by `step'."
  714. mismatch " Returns the first index where `s1' and `s2' do not match. "
  715. memtable
  716. " Creates a membership table which returns t for each element in `ks' and
  717. nil otherwise. "
  718. w/bars
  719. " Prints out the strings printed by each expression in `body',
  720. separated by vertical bars (or whatever the value of `bar*' is). "
  721. thread
  722. " Launches the expressions in `body' in a new thread, returning the
  723. thread ID for that thread. "
  724. trav
  725. " Traverses an object `x'; each function in `fs' is applied to it, and
  726. sub-nodes of the object may be traversed by (self <node>) in any of the
  727. functions.
  728. See also [[treewise]] [[ontree]] "
  729. get
  730. " Returns a fn that calls it argument on `index'. "
  731. butlast
  732. " Returns a list containing every element of `x' but the last.
  733. See also: [[cut]] "
  734. between
  735. " As 'each, but runs `within' between each iteration of `body'.
  736. See also [[each]] "
  737. tofile
  738. " Redirects stdout to the file `name' within `body'.
  739. See also [[fromfile]] [[w/outfile]] [[w/stdout]] "
  740. fromfile
  741. " Redirects standard input from the file `name' within `body'.
  742. See also [[tofile]] [[w/infile]] [[w/stdin]] "
  743. mapeach
  744. " Maps `(fn (,var) ,@body)' over `lst'.
  745. See also [[each]] [[map]] [[mappendeach]] "
  746. )