nydp 0.5.1 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (143) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/README.md +77 -56
  4. data/lib/lisp/core-000.nydp +1 -1
  5. data/lib/lisp/core-010-precompile.nydp +49 -29
  6. data/lib/lisp/core-012-utils.nydp +12 -8
  7. data/lib/lisp/core-015-documentation.nydp +41 -15
  8. data/lib/lisp/core-017-builtin-dox.nydp +621 -100
  9. data/lib/lisp/core-020-utils.nydp +33 -6
  10. data/lib/lisp/core-025-warnings.nydp +1 -1
  11. data/lib/lisp/core-030-syntax.nydp +64 -48
  12. data/lib/lisp/core-035-flow-control.nydp +20 -28
  13. data/lib/lisp/core-037-list-utils.nydp +84 -21
  14. data/lib/lisp/core-040-utils.nydp +8 -5
  15. data/lib/lisp/core-041-string-utils.nydp +17 -11
  16. data/lib/lisp/core-043-list-utils.nydp +140 -77
  17. data/lib/lisp/core-045-dox-utils.nydp +1 -0
  18. data/lib/lisp/core-050-test-runner.nydp +8 -12
  19. data/lib/lisp/core-070-prefix-list.nydp +19 -15
  20. data/lib/lisp/core-080-pretty-print.nydp +13 -5
  21. data/lib/lisp/core-090-hook.nydp +11 -11
  22. data/lib/lisp/core-100-utils.nydp +51 -66
  23. data/lib/lisp/core-110-hash-utils.nydp +34 -7
  24. data/lib/lisp/core-120-settings.nydp +14 -9
  25. data/lib/lisp/core-130-validations.nydp +28 -13
  26. data/lib/lisp/core-900-benchmarking.nydp +420 -47
  27. data/lib/lisp/tests/000-empty-args-examples.nydp +5 -0
  28. data/lib/lisp/tests/andify-examples.nydp +1 -1
  29. data/lib/lisp/tests/auto-hash-examples.nydp +6 -1
  30. data/lib/lisp/tests/best-examples.nydp +1 -1
  31. data/lib/lisp/tests/boot-tests.nydp +1 -1
  32. data/lib/lisp/tests/date-examples.nydp +129 -102
  33. data/lib/lisp/tests/destructuring-examples.nydp +1 -1
  34. data/lib/lisp/tests/dox-tests.nydp +2 -2
  35. data/lib/lisp/tests/hash-examples.nydp +58 -33
  36. data/lib/lisp/tests/list-tests.nydp +137 -1
  37. data/lib/lisp/tests/pretty-print-tests.nydp +12 -0
  38. data/lib/lisp/tests/rotate-2d-array-examples.nydp +26 -0
  39. data/lib/lisp/tests/sort-examples.nydp +5 -5
  40. data/lib/lisp/tests/string-tests.nydp +16 -5
  41. data/lib/lisp/tests/syntax-tests.nydp +10 -2
  42. data/lib/lisp/tests/time-examples.nydp +8 -1
  43. data/lib/lisp/tests/unparse-tests.nydp +13 -7
  44. data/lib/nydp/assignment.rb +15 -28
  45. data/lib/nydp/builtin/abs.rb +4 -3
  46. data/lib/nydp/builtin/apply.rb +8 -10
  47. data/lib/nydp/builtin/cdr_set.rb +1 -1
  48. data/lib/nydp/builtin/comment.rb +1 -3
  49. data/lib/nydp/builtin/date.rb +11 -28
  50. data/lib/nydp/builtin/divide.rb +3 -10
  51. data/lib/nydp/builtin/ensuring.rb +6 -21
  52. data/lib/nydp/builtin/error.rb +2 -4
  53. data/lib/nydp/builtin/eval.rb +9 -4
  54. data/lib/nydp/builtin/greater_than.rb +7 -8
  55. data/lib/nydp/builtin/handle_error.rb +10 -34
  56. data/lib/nydp/builtin/hash.rb +24 -45
  57. data/lib/nydp/builtin/inspect.rb +1 -3
  58. data/lib/nydp/builtin/is_equal.rb +4 -7
  59. data/lib/nydp/builtin/less_than.rb +6 -7
  60. data/lib/nydp/builtin/log.rb +7 -0
  61. data/lib/nydp/builtin/math_ceiling.rb +1 -3
  62. data/lib/nydp/builtin/math_floor.rb +1 -3
  63. data/lib/nydp/builtin/math_power.rb +1 -3
  64. data/lib/nydp/builtin/math_round.rb +2 -2
  65. data/lib/nydp/builtin/minus.rb +7 -14
  66. data/lib/nydp/builtin/parse.rb +5 -5
  67. data/lib/nydp/builtin/parse_in_string.rb +5 -7
  68. data/lib/nydp/builtin/plus.rb +14 -31
  69. data/lib/nydp/builtin/pre_compile.rb +1 -3
  70. data/lib/nydp/builtin/puts.rb +4 -8
  71. data/lib/nydp/builtin/quit.rb +1 -1
  72. data/lib/nydp/builtin/rand.rb +6 -11
  73. data/lib/nydp/builtin/random_string.rb +2 -4
  74. data/lib/nydp/builtin/rng.rb +25 -0
  75. data/lib/nydp/builtin/ruby_wrap.rb +27 -14
  76. data/lib/nydp/builtin/script_run.rb +1 -3
  77. data/lib/nydp/builtin/set_intersection.rb +3 -4
  78. data/lib/nydp/builtin/set_union.rb +3 -4
  79. data/lib/nydp/builtin/sort.rb +2 -7
  80. data/lib/nydp/builtin/string_match.rb +5 -13
  81. data/lib/nydp/builtin/string_replace.rb +2 -7
  82. data/lib/nydp/builtin/string_split.rb +3 -8
  83. data/lib/nydp/builtin/sym.rb +2 -9
  84. data/lib/nydp/builtin/thread_locals.rb +2 -2
  85. data/lib/nydp/builtin/time.rb +38 -44
  86. data/lib/nydp/builtin/times.rb +6 -15
  87. data/lib/nydp/builtin/to_integer.rb +8 -14
  88. data/lib/nydp/builtin/to_string.rb +2 -13
  89. data/lib/nydp/builtin/type_of.rb +10 -16
  90. data/lib/nydp/builtin/vm_info.rb +2 -10
  91. data/lib/nydp/builtin.rb +15 -37
  92. data/lib/nydp/compiler.rb +29 -19
  93. data/lib/nydp/cond.rb +95 -88
  94. data/lib/nydp/context_symbol.rb +11 -9
  95. data/lib/nydp/core.rb +74 -73
  96. data/lib/nydp/core_ext.rb +87 -26
  97. data/lib/nydp/date.rb +22 -19
  98. data/lib/nydp/error.rb +2 -3
  99. data/lib/nydp/function_invocation.rb +76 -289
  100. data/lib/nydp/helper.rb +18 -9
  101. data/lib/nydp/interpreted_function.rb +159 -25
  102. data/lib/nydp/lexical_context.rb +9 -8
  103. data/lib/nydp/lexical_context_builder.rb +1 -1
  104. data/lib/nydp/literal.rb +3 -7
  105. data/lib/nydp/loop.rb +72 -0
  106. data/lib/nydp/namespace.rb +52 -0
  107. data/lib/nydp/pair.rb +146 -50
  108. data/lib/nydp/parser.rb +9 -11
  109. data/lib/nydp/plugin.rb +88 -19
  110. data/lib/nydp/runner.rb +141 -23
  111. data/lib/nydp/symbol.rb +16 -26
  112. data/lib/nydp/symbol_lookup.rb +3 -2
  113. data/lib/nydp/tokeniser.rb +1 -1
  114. data/lib/nydp/truth.rb +2 -37
  115. data/lib/nydp/version.rb +1 -1
  116. data/lib/nydp.rb +33 -44
  117. data/nydp.gemspec +2 -1
  118. data/spec/date_spec.rb +26 -32
  119. data/spec/embedded_spec.rb +22 -22
  120. data/spec/error_spec.rb +12 -16
  121. data/spec/foreign_hash_spec.rb +21 -36
  122. data/spec/hash_non_hash_behaviour_spec.rb +12 -29
  123. data/spec/hash_spec.rb +36 -49
  124. data/spec/literal_spec.rb +6 -6
  125. data/spec/nydp_spec.rb +14 -14
  126. data/spec/pair_spec.rb +8 -8
  127. data/spec/parser_spec.rb +41 -37
  128. data/spec/rand_spec.rb +1 -4
  129. data/spec/spec_helper.rb +3 -3
  130. data/spec/string_atom_spec.rb +15 -16
  131. data/spec/symbol_spec.rb +27 -52
  132. data/spec/thread_local_spec.rb +23 -8
  133. data/spec/time_spec.rb +4 -10
  134. data/spec/tokeniser_spec.rb +10 -10
  135. metadata +25 -13
  136. data/lib/nydp/builtin/modulo.rb +0 -11
  137. data/lib/nydp/builtin/regexp.rb +0 -7
  138. data/lib/nydp/builtin/sqrt.rb +0 -7
  139. data/lib/nydp/builtin/string_pad_left.rb +0 -7
  140. data/lib/nydp/builtin/string_pad_right.rb +0 -7
  141. data/lib/nydp/hash.rb +0 -9
  142. data/lib/nydp/image_store.rb +0 -21
  143. data/lib/nydp/vm.rb +0 -129
@@ -1,100 +1,621 @@
1
- (dox-add-doc 'cons 'def '("with args a and b, returns a new cons cell, (a . b)") '(a b) nil '(list-manipulation))
2
- (dox-add-doc 'car 'def '("with args a, where a is a cons cell (x . y), return x." "Commonly used to get the first element of a list") '(a) nil '(list-manipulation))
3
- (dox-add-doc 'cdr 'def '("with args a, where a is a cons cell (x . y), return y." "Commonly used to get contents of a list, excluding the first element") '(a) nil '(list-manipulation))
4
- (dox-add-doc 'log 'def '("write arg to Nydp.logger ; be sure to assign Nydp.logger first!") '(arg) nil '(nydp-core))
5
- (dox-add-doc '+ 'def '("with rest-args things, return the sum of the elements of things." "Will also increment dates and concatenate strings and lists") 'things nil '(math))
6
- (dox-add-doc '- 'def '("return the result of subtracting all other args from the first arg." "(- a b c d) is equivalent to (- a (+ b c d))") 'things nil '(math))
7
- (dox-add-doc '* 'def '("with rest-args things, return the product of the elements of things.") 'things nil '(math))
8
- (dox-add-doc '/ 'def '("return the result of dividing all other args into the first arg." "(/ a b c d) is equivalent to (/ a (* b c d))") 'things nil '(math))
9
- (dox-add-doc '> 'def '("true if each arg is greater than the next arg") 'things nil '(math))
10
- (dox-add-doc '< 'def '("true if each arg is less than the next arg") 'things nil '(math))
11
- (dox-add-doc '** 'def '("returns a to the power of b") '(a b) nil '(math))
12
- (dox-add-doc '⌊ 'def '("returns the floor of a (round towards -∞)") '(a) nil '(math))
13
- (dox-add-doc '⌈ 'def '("returns the ceiling of a (round towards +∞)") '(a) nil '(math))
14
- (dox-add-doc 'round 'def '("returns a rounded half-away from zero") '(a) nil '(math))
15
- (dox-add-doc 'mod 'def '("return the remainder after diving a by b") '(a b) nil '(math))
16
- (dox-add-doc 'eval 'def '("evaluate the given lisp expression") '(expr) nil '(nydp-core))
17
- (dox-add-doc 'hash 'def '("create a new Hash instance") nil nil '(hash-manipulation))
18
- (dox-add-doc 'apply 'def '("invoke f with args 'args") '(f . args) nil '(nydp-core))
19
- (dox-add-doc 'date 'def '("create a new date instance") '(year month day) nil '(date-time))
20
- (dox-add-doc 'error 'def '("raise an exception") 'args nil '(flow-control))
21
- (dox-add-doc 'parse 'def '("parse the given string and return the corresponding lisp objects") '(str) nil '(nydp-core))
22
- (dox-add-doc 'p 'def '("print a message on $stdout") 'args nil '(nydp-core))
23
- (dox-add-doc 'sort 'def '("return 'things, sorted according to their natural sort order") 'things nil '(list-manipulation))
24
- (dox-add-doc 'sqrt 'def '("return the square root of 'arg") '(arg) nil '(math))
25
- (dox-add-doc 'sym 'def '("return the symbol for the given string 'arg") '(arg) nil '(nydp-core))
26
- (dox-add-doc 'list 'def '("returns args as a list") 'args nil '(nydp-core))
27
- (dox-add-doc 'noop 'def '("does nothing; returns nil") nil nil '(nydp-core))
28
- (dox-add-doc 'x1 'def '("just returns arg; the identity function") '(arg) nil '(nydp-core))
29
- (dox-add-doc 'caar 'def '("car of car; same as (car (car arg))") '(arg) nil '(nydp-core))
30
- (dox-add-doc 'cadr 'def '("car of cdr; same as (car (cdr arg))") '(arg) nil '(nydp-core))
31
- (dox-add-doc 'cdar 'def '("cdr of car; same as (cdr (car arg))") '(arg) nil '(nydp-core))
32
- (dox-add-doc 'cddr 'def '("cdr of cdr; same as (cdr (cdr arg))") '(arg) nil '(nydp-core))
33
- (dox-add-doc 'no 'def '("t if arg is nil, nil otherwise") '(arg) nil '(nydp-core))
34
- (dox-add-doc 'just 'def '("just returns arg; the identity function") '(arg) nil '(nydp-core))
35
- (dox-add-doc 'isa 'def '("t if (type-of obj) is equal to type") '(type obj) nil '(nydp-core))
36
- (dox-add-doc 'pair? 'def '("t if arg is a cons cell or (equivalently) the start of a list") '(arg) nil '(nydp-core))
37
- (dox-add-doc 'hash? 'def '("t if arg is a hash") '(arg) nil '(nydp-core))
38
- (dox-add-doc 'sym? 'def '("t if arg is a symbol, nil otherwise") '(arg) nil '(nydp-core))
39
- (dox-add-doc 'ensuring 'def '("execute 'try-f, then 'ensure-f afterwards"
40
- "'ensure-f will always be executed, even if there is an error in 'try-f"
41
- "returns the return value of 'try-f. Similar to try/finally in java, or begin/ensure in ruby.") '(ensure-f try-f) nil '(flow-control))
42
- (dox-add-doc 'inspect 'def '("return a string representing 'arg, potentially (but not always) in a way that can be parsed back in to get the original object") '(arg) nil '(nydp-core))
43
- (dox-add-doc 'comment 'def '("does nothing at all." "Intercepted inside 'def and 'mac and used for documentation") '(arg) nil '(nydp-core))
44
- (dox-add-doc 'parse-in-string 'def '("parse the given string assuming a string-open delimiter has already been encountered") '(str) nil '(nydp-core))
45
- (dox-add-doc 'rand 'def '("return a random number ; with no args, between 0 and 1"
46
- "with 1 arg, an integer less than arg"
47
- "with two args, an integer >= arg 0 and < arg 1") 'args nil '(math))
48
- (dox-add-doc 'random-string 'def '("return a random string of length 'len (default 10)") '(len) nil '(string-manipulation))
49
- (dox-add-doc 'regexp 'def '("return a regular expression compiled from the given string") '(str) nil '(string-manipulation))
50
- (dox-add-doc 'to-string 'def '("return a human-readable string representation of 'arg") '(arg) nil '(string-manipulation))
51
- (dox-add-doc 'string-length 'def '("return the length of 'arg") '(arg) nil '(string-manipulation))
52
- (dox-add-doc 'string-replace 'def '("replace 'pattern with 'replacement in 'str") '(pattern replacement str) nil '(string-manipulation))
53
- (dox-add-doc 'string-split 'def '("split 'str delimited by 'delim") '(str delim) nil '(string-manipulation))
54
- (dox-add-doc 'string-match 'def '("if 'str matches 'pattern, return hash with keys 'match and 'captures ; otherwise nil") '(str pattern) nil '(string-manipulation))
55
- (dox-add-doc 'time 'def '("with no args, return the current time."
56
- "With one arg, if 'arg-0 is a number, return the current time plus 'arg-0 seconds."
57
- "With one arg, if 'arg-0 is a date, return the time at the beginning of the given date."
58
- "With one arg, if 'arg-0 is a time, return the number of seconds between 'arg-0 and now."
59
- "With two args, 'arg-0 must be a time."
60
- "If 'arg-1 is a number, return 'arg-0 plus 'arg-1 seconds as a time object."
61
- "If 'arg-1 is a time, return the number of seconds between the two (- 'arg-0 arg-1)."
62
- "Otherwise, expect 3 or more args, to construct a time from"
63
- "year, month, date, hours, minutes, seconds, milliseconds, reading arguments in that order,"
64
- "where hours, minutes, seconds, and milliseconds are optional") 'args nil '(date-time))
65
- (dox-add-doc 'thread-locals 'def '("return a hash bound to the current thread") nil nil '(nydp-core))
66
- (dox-add-doc 'type-of 'def '("return a symbol for the type of 'arg") '(arg) nil '(nydp-core))
67
- (dox-add-doc 'eq? 'def '("return 't if 'arg-0 and 'arg-1 are equal, nil otherwise") '(arg-0 arg-1) nil '(nydp-core))
68
- (dox-add-doc 'cdr-set 'def '("set the cdr of the given 'cell to 'arg, returns 'cell") '(cell arg) nil '(list-manipulation))
69
- (dox-add-doc 'hash-get 'def '("return the value stored by 'key in 'hsh") '(hsh key) nil '(hash-manipulation))
70
- (dox-add-doc 'hash-set 'def '("store 'val under 'key in 'hsh, return 'val") '(hsh key val) nil '(hash-manipulation))
71
- (dox-add-doc 'hash-keys 'def '("return the list of keys in 'hsh") '(hsh) nil '(hash-manipulation))
72
- (dox-add-doc 'hash-key? 'def '("return 't if 'key is a key of 'hsh") '(hsh key) nil '(hash-manipulation))
73
- (dox-add-doc 'hash-merge 'def '("return a new hash containing keys and values from 'h0 and 'h1, where values of 'h1 override values of 'h0") '(h0 h1) nil '(hash-manipulation))
74
- (dox-add-doc 'vm-info 'def '("return some information about the state of the current thread") nil nil '(nydp-core))
75
- (dox-add-doc 'pre-compile 'def '("transform parsed forms before the compile and eval stages") '(arg) nil '(nydp-compilation))
76
- (dox-add-doc 'script-run 'def '("announces the start of a plugin load or a script load."
77
- "'event may be one of '(script-start script-end plugin-start plugin-end)"
78
- "'name is the name of the script or plugin concerned") '(event name) nil '(nydp-core))
79
-
80
- (dox-add-doc 'chapter-end 'def '("Announce the end of a chapter. Called by 'plugin-start, 'plugin-end, 'script-start, 'script-end") nil nil '(nydp/documentation))
81
- (dox-add-doc 'chapter-start 'def '("Announce the start of a chapter. Creates a new chapter if the named chapter does not already exist") '(chapter-name description) nil '(nydp/documentation))
82
- (dox-add-doc 'chapter-names 'def '("Get the names of all the chapters nydp knows about") nil nil '(nydp/documentation))
83
- (dox-add-doc 'chapter-current 'def '("Get the name of the chapter in progress right now - this is normally the last value sent to 'chapter-start") nil nil '(nydp/documentation))
84
- (dox-add-doc 'chapter-delete 'def '("Remove the named chapter") '(name) nil '(nydp/documentation))
85
- (dox-add-doc 'chapter-find 'def '("Get the named chapter") '(name) nil '(nydp/documentation))
86
- (dox-add-doc 'set-intersection 'def '("return the intersection of the given lists") 'args nil '(list-manipulation))
87
- (dox-add-doc '⋂ 'def '("return the intersection of the given lists") 'args nil '(list-manipulation))
88
- (dox-add-doc 'set-union 'def '("return the union of the given lists") 'args nil '(list-manipulation))
89
- (dox-add-doc '⋃ 'def '("return the union of the given lists") 'args nil '(list-manipulation))
90
- (dox-add-doc 'dox-add-doc 'def '("Store the provided documentation item."
91
- "'name is the name of the item"
92
- "'what is the type of the item ('def or 'mac or 'thingy ... this is user-definable, not related to 'type-of)"
93
- "'texts is a list of strings to store for this item"
94
- "'args is the args if the item has the notion of args"
95
- "'src the source code of the item if any"
96
- "'chapters the chapters to which the item should be added, if any") '(name what texts args src chapters) nil '(nydp/documentation))
97
- (dox-add-doc 'dox-add-examples 'def '("Add the given examples to the dox for the named item") '(name example-exprs) nil '(nydp/documentation))
98
- (dox-add-doc 'dox-types 'def '("Get the list of types of documented items") nil nil '(nydp/documentation))
99
- (dox-add-doc 'dox-lookup 'def '("Get the documentation for the given item") '(name) nil '(nydp/documentation))
100
- (dox-add-doc 'dox-items-by-type 'def '("Get the list of dox items of a given type") '(type) nil '(nydp/documentation))
1
+ (mac dox/attrs (chaps)
2
+ `(hash 'chapters ',(if chaps `(,@chaps) `(,(chapter-current)))
3
+ 'plugin ',this-plugin
4
+ 'file ',this-script))
5
+
6
+ (dox-add-doc 'cons
7
+ 'def
8
+ '("with args a and b, returns a new cons cell, (a . b)")
9
+ '(a b)
10
+ nil
11
+ (dox/attrs (list-manipulation)))
12
+
13
+ (dox-add-doc 'car
14
+ 'def
15
+ '("with args a, where a is a cons cell (x . y), return x."
16
+ "Commonly used to get the first element of a list")
17
+ '(a)
18
+ nil
19
+ (dox/attrs (list-manipulation)))
20
+
21
+ (dox-add-doc 'cdr
22
+ 'def
23
+ '("with args a, where a is a cons cell (x . y), return y."
24
+ "Commonly used to get contents of a list, excluding the first element")
25
+ '(a)
26
+ nil
27
+ (dox/attrs (list-manipulation)))
28
+
29
+ (dox-add-doc 'log
30
+ 'def
31
+ '("write arg to Nydp.logger ; be sure to assign Nydp.logger first!")
32
+ '(arg)
33
+ nil
34
+ (dox/attrs (nydp-core)))
35
+
36
+ (dox-add-doc '+
37
+ 'def
38
+ '("with rest-args things, return the sum of the elements of things."
39
+ "Will also increment dates and concatenate strings and lists")
40
+ 'things
41
+ nil
42
+ (dox/attrs (math)))
43
+
44
+ (dox-add-doc '-
45
+ 'def
46
+ '("return the result of subtracting all other args from the first arg."
47
+ "(- a b c d) is equivalent to (- a (+ b c d))")
48
+ 'things
49
+ nil
50
+ (dox/attrs (math)))
51
+
52
+ (dox-add-doc '*
53
+ 'def
54
+ '("with rest-args things, return the product of the elements of things.")
55
+ 'things
56
+ nil
57
+ (dox/attrs (math)))
58
+
59
+ (dox-add-doc '/
60
+ 'def
61
+ '("return the result of dividing all other args into the first arg."
62
+ "(/ a b c d) is equivalent to (/ a (* b c d))")
63
+ 'things
64
+ nil
65
+ (dox/attrs (math)))
66
+
67
+ (dox-add-doc '>
68
+ 'def
69
+ '("true if each arg is greater than the next arg")
70
+ 'things
71
+ nil
72
+ (dox/attrs (math)))
73
+
74
+ (dox-add-doc '<
75
+ 'def
76
+ '("true if each arg is less than the next arg")
77
+ 'things
78
+ nil
79
+ (dox/attrs (math)))
80
+
81
+ (dox-add-doc '**
82
+ 'def
83
+ '("returns a to the power of b")
84
+ '(a b)
85
+ nil
86
+ (dox/attrs (math)))
87
+
88
+ (dox-add-doc (sym "⌊")
89
+ 'def
90
+ '("returns the floor of a (round towards -∞)")
91
+ '(a)
92
+ nil
93
+ (dox/attrs (math)))
94
+
95
+ (dox-add-doc (sym "⌈")
96
+ 'def
97
+ '("returns the ceiling of a (round towards +∞)")
98
+ '(a)
99
+ nil
100
+ (dox/attrs (math)))
101
+
102
+ (dox-add-doc 'round
103
+ 'def
104
+ '("returns a rounded half-away from zero")
105
+ '(a)
106
+ nil
107
+ (dox/attrs (math)))
108
+
109
+ (dox-add-doc 'mod
110
+ 'def
111
+ '("return the remainder after diving a by b")
112
+ '(a b)
113
+ nil
114
+ (dox/attrs (math)))
115
+
116
+ (dox-add-doc 'eval
117
+ 'def
118
+ '("evaluate the given lisp expression")
119
+ '(expr)
120
+ nil
121
+ (dox/attrs (nydp-core)))
122
+
123
+ (dox-add-doc 'hash
124
+ 'def
125
+ '("create a new Hash instance")
126
+ nil
127
+ nil
128
+ (dox/attrs (hash-manipulation)))
129
+
130
+ (dox-add-doc 'apply
131
+ 'def
132
+ '("invoke f with args 'args")
133
+ '(f . args)
134
+ nil
135
+ (dox/attrs (nydp-core)))
136
+
137
+ (dox-add-doc 'date
138
+ 'def
139
+ '("create a new date instance")
140
+ '(year month day)
141
+ nil
142
+ (dox/attrs (date-time)))
143
+
144
+ (dox-add-doc 'error
145
+ 'def
146
+ '("raise an exception")
147
+ 'args
148
+ nil
149
+ (dox/attrs (flow-control)))
150
+
151
+ (dox-add-doc 'parse
152
+ 'def
153
+ '("parse the given string and return the corresponding lisp objects")
154
+ '(str)
155
+ nil
156
+ (dox/attrs (nydp-core)))
157
+
158
+ (dox-add-doc 'p
159
+ 'def
160
+ '("print a message on $stdout")
161
+ 'args
162
+ nil
163
+ (dox/attrs (nydp-core)))
164
+
165
+ (dox-add-doc 'sort
166
+ 'def
167
+ '("return 'things, sorted according to their natural sort order")
168
+ 'things
169
+ nil
170
+ (dox/attrs (list-manipulation)))
171
+
172
+ (dox-add-doc 'sqrt
173
+ 'def
174
+ '("return the square root of 'arg")
175
+ '(arg)
176
+ nil
177
+ (dox/attrs (math)))
178
+
179
+ (dox-add-doc 'ln
180
+ 'def
181
+ '("return the natural logarithm of 'arg")
182
+ '(arg)
183
+ nil
184
+ (dox/attrs (math)))
185
+
186
+ (dox-add-doc 'sym
187
+ 'def
188
+ '("return the symbol for the given string 'arg")
189
+ '(arg)
190
+ nil
191
+ (dox/attrs (nydp-core)))
192
+
193
+ (dox-add-doc 'list
194
+ 'def
195
+ '("returns args as a list")
196
+ 'args
197
+ nil
198
+ (dox/attrs (nydp-core)))
199
+
200
+ (dox-add-doc 'noop
201
+ 'def
202
+ '("does nothing; returns nil")
203
+ nil
204
+ nil
205
+ (dox/attrs (nydp-core)))
206
+
207
+ (dox-add-doc 'x1
208
+ 'def
209
+ '("just returns arg; the identity function")
210
+ '(arg)
211
+ nil
212
+ (dox/attrs (nydp-core)))
213
+
214
+ (dox-add-doc 'caar
215
+ 'def
216
+ '("car of car; same as (car (car arg))")
217
+ '(arg)
218
+ nil
219
+ (dox/attrs (nydp-core)))
220
+
221
+ (dox-add-doc 'cadr
222
+ 'def
223
+ '("car of cdr; same as (car (cdr arg))")
224
+ '(arg)
225
+ nil
226
+ (dox/attrs (nydp-core)))
227
+
228
+ (dox-add-doc 'cdar
229
+ 'def
230
+ '("cdr of car; same as (cdr (car arg))")
231
+ '(arg)
232
+ nil
233
+ (dox/attrs (nydp-core)))
234
+
235
+ (dox-add-doc 'cddr
236
+ 'def
237
+ '("cdr of cdr; same as (cdr (cdr arg))")
238
+ '(arg)
239
+ nil
240
+ (dox/attrs (nydp-core)))
241
+
242
+ (dox-add-doc 'no
243
+ 'def
244
+ '("t if arg is nil, nil otherwise")
245
+ '(arg)
246
+ nil
247
+ (dox/attrs (nydp-core)))
248
+
249
+ (dox-add-doc 'just
250
+ 'def
251
+ '("just returns arg; the identity function")
252
+ '(arg)
253
+ nil
254
+ (dox/attrs (nydp-core)))
255
+
256
+ (dox-add-doc 'isa
257
+ 'def
258
+ '("t if (type-of obj) is equal to type")
259
+ '(type obj)
260
+ nil
261
+ (dox/attrs (nydp-core)))
262
+
263
+ (dox-add-doc 'pair?
264
+ 'def
265
+ '("t if arg is a cons cell or (equivalently) the start of a list")
266
+ '(arg)
267
+ nil
268
+ (dox/attrs (nydp-core)))
269
+
270
+ (dox-add-doc 'hash?
271
+ 'def
272
+ '("t if arg is a hash")
273
+ '(arg)
274
+ nil
275
+ (dox/attrs (nydp-core)))
276
+
277
+ (dox-add-doc 'sym?
278
+ 'def
279
+ '("t if arg is a symbol, nil otherwise")
280
+ '(arg)
281
+ nil
282
+ (dox/attrs (nydp-core)))
283
+
284
+ (dox-add-doc 'ensuring
285
+ 'def
286
+ '("execute 'try-f, then 'ensure-f afterwards"
287
+ "'ensure-f will always be executed, even if there is an error in 'try-f"
288
+ "returns the return value of 'try-f. Similar to try/finally in java, or begin/ensure in ruby.")
289
+ '(ensure-f try-f)
290
+ nil
291
+ (dox/attrs (flow-control)))
292
+
293
+ (dox-add-doc 'inspect
294
+ 'def
295
+ '("return a string representing 'arg, potentially (but not always) in a way that "
296
+ "can be parsed back in to get the original object")
297
+ '(arg)
298
+ nil
299
+ (dox/attrs (nydp-core)))
300
+
301
+ (dox-add-doc 'comment
302
+ 'def
303
+ '("does nothing at all." "Intercepted inside 'def and 'mac and used for documentation")
304
+ '(arg)
305
+ nil
306
+ (dox/attrs (nydp-core)))
307
+
308
+ (dox-add-doc 'parse-in-string
309
+ 'def
310
+ '("parse the given string assuming a string-open delimiter has already been encountered")
311
+ '(str)
312
+ nil
313
+ (dox/attrs (nydp-core)))
314
+
315
+ (dox-add-doc 'rand
316
+ 'def
317
+ '("return a random number ; with no args, between 0 and 1"
318
+ "with 1 arg, an integer less than arg"
319
+ "with two args, an integer >= arg 0 and < arg 1")
320
+ 'args
321
+ nil
322
+ (dox/attrs (math)))
323
+
324
+ (dox-add-doc 'rng
325
+ 'def
326
+ '("return a random number generator ; with no args, uses a random seed."
327
+ "with 1 arg, seeds the rng with that number, for a reproducible sequence of random numbers."
328
+ "the returned rng is a function which can be called like (rand) ; eg. (let r (rng) (list (r) (r) (r))) ; returns a list of 3 random numbers")
329
+ 'args
330
+ nil
331
+ (dox/attrs (math)))
332
+
333
+ (dox-add-doc 'random-string
334
+ 'def
335
+ '("return a random string of length 'len (default 10)")
336
+ '(len)
337
+ nil
338
+ (dox/attrs (string-manipulation)))
339
+
340
+ (dox-add-doc 'regexp
341
+ 'def
342
+ '("return a regular expression compiled from the given string")
343
+ '(str)
344
+ nil
345
+ (dox/attrs (string-manipulation)))
346
+
347
+ (dox-add-doc 'to-string
348
+ 'def
349
+ '("return a human-readable string representation of 'arg")
350
+ '(arg)
351
+ nil
352
+ (dox/attrs (string-manipulation)))
353
+
354
+ (dox-add-doc 'string-length
355
+ 'def
356
+ '("return the length of 'arg")
357
+ '(arg)
358
+ nil
359
+ (dox/attrs (string-manipulation)))
360
+
361
+ (dox-add-doc 'string/pad-left
362
+ 'def
363
+ '("return a new string with 'padding added to the left of 'str such that is 'length characters long")
364
+ '(str length padding)
365
+ nil
366
+ (dox/attrs (string-manipulation)))
367
+
368
+ (dox-add-doc 'string/pad-right
369
+ 'def
370
+ '("return a new string with 'padding added to the right of 'str such that is 'length characters long")
371
+ '(str length padding)
372
+ nil
373
+ (dox/attrs (string-manipulation)))
374
+
375
+ (dox-add-doc 'string/force-encoding
376
+ 'def
377
+ '("send ruby's native #force_encoding to the string argument")
378
+ '(str encoding)
379
+ nil
380
+ (dox/attrs (string-manipulation)))
381
+
382
+ (dox-add-doc 'string-replace
383
+ 'def
384
+ '("replace 'pattern with 'replacement in 'str")
385
+ '(pattern replacement str)
386
+ nil
387
+ (dox/attrs (string-manipulation)))
388
+
389
+ (dox-add-doc 'string-split
390
+ 'def
391
+ '("split 'str delimited by 'delim")
392
+ '(str delim)
393
+ nil
394
+ (dox/attrs (string-manipulation)))
395
+
396
+ (dox-add-doc 'string-match
397
+ 'def
398
+ '("if 'str matches 'pattern, return hash with keys 'match and 'captures ; otherwise nil")
399
+ '(str pattern)
400
+ nil
401
+ (dox/attrs (string-manipulation)))
402
+
403
+ (dox-add-doc 'to-list
404
+ 'def
405
+ '("tries to convert 'thing to a list (for Hash instances, returns a list of two-element lists)")
406
+ '(thing)
407
+ nil
408
+ (dox/attrs (string-manipulation)))
409
+
410
+ (dox-add-doc 'time
411
+ 'def
412
+ '("with no args, return the current time."
413
+ "With one arg, if 'arg-0 is a number, return the current time plus 'arg-0 seconds."
414
+ "With one arg, if 'arg-0 is a date, return the time at the beginning of the given date."
415
+ "With one arg, if 'arg-0 is a time, return the number of seconds between 'arg-0 and now."
416
+ "With two args, 'arg-0 must be a time."
417
+ "If 'arg-1 is a number, return 'arg-0 plus 'arg-1 seconds as a time object."
418
+ "If 'arg-1 is a time, return the number of seconds between the two (- 'arg-0 arg-1)."
419
+ "Otherwise, expect 3 or more args, to construct a time from"
420
+ "year, month, date, hours, minutes, seconds, milliseconds, reading arguments in that order,"
421
+ "where hours, minutes, seconds, and milliseconds are optional")
422
+ 'args
423
+ nil
424
+ (dox/attrs (date-time)))
425
+
426
+ (dox-add-doc 'thread-locals
427
+ 'def
428
+ '("return a hash bound to the current thread")
429
+ nil
430
+ nil
431
+ (dox/attrs (nydp-core)))
432
+
433
+ (dox-add-doc 'type-of
434
+ 'def
435
+ '("return a symbol for the type of 'arg")
436
+ '(arg)
437
+ nil
438
+ (dox/attrs (nydp-core)))
439
+
440
+ (dox-add-doc 'eq?
441
+ 'def
442
+ '("return 't if 'arg-0 and 'arg-1 are equal, nil otherwise")
443
+ '(arg-0 arg-1)
444
+ nil
445
+ (dox/attrs (nydp-core)))
446
+
447
+ (dox-add-doc 'cdr-set
448
+ 'def
449
+ '("set the cdr of the given 'cell to 'arg, returns 'cell")
450
+ '(cell arg)
451
+ nil
452
+ (dox/attrs (list-manipulation)))
453
+
454
+ (dox-add-doc 'hash-get
455
+ 'def
456
+ '("return the value stored by 'key in 'hsh")
457
+ '(hsh key)
458
+ nil
459
+ (dox/attrs (hash-manipulation)))
460
+
461
+ (dox-add-doc 'hash-set
462
+ 'def
463
+ '("store 'val under 'key in 'hsh, return 'val")
464
+ '(hsh key val)
465
+ nil
466
+ (dox/attrs (hash-manipulation)))
467
+
468
+ (dox-add-doc 'hash-keys
469
+ 'def
470
+ '("return the list of keys in 'hsh")
471
+ '(hsh)
472
+ nil
473
+ (dox/attrs (hash-manipulation)))
474
+
475
+ (dox-add-doc 'hash-key?
476
+ 'def
477
+ '("return 't if 'key is a key of 'hsh")
478
+ '(hsh key)
479
+ nil
480
+ (dox/attrs (hash-manipulation)))
481
+
482
+ (dox-add-doc 'hash-merge
483
+ 'def
484
+ '("return a new hash containing keys and values from 'h0 and 'h1, where values of 'h1 override values of 'h0")
485
+ '(h0 h1)
486
+ nil
487
+ (dox/attrs (hash-manipulation)))
488
+
489
+ (dox-add-doc 'vm-info
490
+ 'def
491
+ '("return some information about the state of the current thread")
492
+ nil
493
+ nil
494
+ (dox/attrs (nydp-core)))
495
+
496
+ (dox-add-doc 'pre-compile
497
+ 'def
498
+ '("transform parsed forms before the compile and eval stages")
499
+ '(arg)
500
+ nil
501
+ (dox/attrs (nydp-compilation)))
502
+
503
+ (dox-add-doc 'script-run
504
+ 'def
505
+ '("announces the start of a plugin load or a script load."
506
+ "'event may be one of '(script-start script-end plugin-start plugin-end)"
507
+ "'name is the name of the script or plugin concerned")
508
+ '(event name)
509
+ nil
510
+ (dox/attrs (nydp-core)))
511
+
512
+ (dox-add-doc 'chapter-end
513
+ 'def
514
+ '("Announce the end of a chapter. Called by 'plugin-start, 'plugin-end, 'script-start, 'script-end")
515
+ nil
516
+ nil
517
+ (dox/attrs (nydp/documentation)))
518
+
519
+ (dox-add-doc 'chapter-start
520
+ 'def
521
+ '("Announce the start of a chapter. Creates a new chapter if the named chapter does not already exist")
522
+ '(chapter-name description)
523
+ nil
524
+ (dox/attrs (nydp/documentation)))
525
+
526
+ (dox-add-doc 'chapter-names
527
+ 'def
528
+ '("Get the names of all the chapters nydp knows about")
529
+ nil
530
+ nil
531
+ (dox/attrs (nydp/documentation)))
532
+
533
+ (dox-add-doc 'chapter-current
534
+ 'def
535
+ '("Get the name of the chapter in progress right now - this is normally the last value sent to 'chapter-start")
536
+ nil
537
+ nil
538
+ (dox/attrs (nydp/documentation)))
539
+
540
+ (dox-add-doc 'chapter-delete
541
+ 'def
542
+ '("Remove the named chapter")
543
+ '(name)
544
+ nil
545
+ (dox/attrs (nydp/documentation)))
546
+
547
+ (dox-add-doc 'chapter-find
548
+ 'def
549
+ '("Get the named chapter")
550
+ '(name)
551
+ nil
552
+ (dox/attrs (nydp/documentation)))
553
+
554
+ (dox-add-doc 'set-intersection
555
+ 'def
556
+ '("return the intersection of the given lists")
557
+ 'args
558
+ nil
559
+ (dox/attrs (list-manipulation)))
560
+
561
+ (dox-add-doc (sym "⋂")
562
+ 'def
563
+ '("return the intersection of the given lists")
564
+ 'args
565
+ nil
566
+ (dox/attrs (list-manipulation)))
567
+
568
+ (dox-add-doc 'set-union
569
+ 'def
570
+ '("return the union of the given lists")
571
+ 'args
572
+ nil
573
+ (dox/attrs (list-manipulation)))
574
+
575
+ (dox-add-doc (sym "⋃")
576
+ 'def
577
+ '("return the union of the given lists")
578
+ 'args
579
+ nil
580
+ (dox/attrs (list-manipulation)))
581
+
582
+ (dox-add-doc 'dox-add-doc
583
+ 'def
584
+ '("Store the provided documentation item."
585
+ "@name@ is the name of the item"
586
+ "@what@ is the type of the item ('def or 'mac or 'thingy ... this is user-definable, not related to 'type-of)"
587
+ "@texts@ is a list of strings to store for this item"
588
+ "@args@ is the args if the item has the notion of args"
589
+ "@src@ the source code of the item if any"
590
+ "@chapters@ the chapters to which the item should be added, if any")
591
+ '(name what texts args src chapters)
592
+ nil
593
+ (dox/attrs (nydp/documentation)))
594
+
595
+ (dox-add-doc 'dox-add-examples
596
+ 'def
597
+ '("Add the given examples to the dox for the named item")
598
+ '(name example-exprs)
599
+ nil
600
+ (dox/attrs (nydp/documentation)))
601
+
602
+ (dox-add-doc 'dox-types
603
+ 'def
604
+ '("Get the list of types of documented items")
605
+ nil
606
+ nil
607
+ (dox/attrs (nydp/documentation)))
608
+
609
+ (dox-add-doc 'dox-lookup
610
+ 'def
611
+ '("Get the documentation for the given item")
612
+ '(name)
613
+ nil
614
+ (dox/attrs (nydp/documentation)))
615
+
616
+ (dox-add-doc 'dox-items-by-type
617
+ 'def
618
+ '("Get the list of dox items of a given type")
619
+ '(type)
620
+ nil
621
+ (dox/attrs (nydp/documentation)))