File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 12021202(define (tl)
12031203 (let ((interactive? (terminal-port? (current-input-port))))
12041204 (when interactive?
1205- (display "Use (quit) or ^D to quit, (tl) to return here after an interrupt.\n"))
1205+ (display "Use (quit) or ^D to quit, (tl) to return here after an interrupt, (help _sym_) for docs and examples .\n"))
12061206 (tl2 interactive?)))
12071207
12081208(define (tl2 interactive?)
Original file line number Diff line number Diff line change @@ -78,7 +78,39 @@ Or come ask questions at http://arclanguage.org/forum"
7878(mac examples (name . tests-and-expected-results)
7979"Shows some example calls of a function as an enhancement of its docstring.
8080Usually provided immediately after a function docstring+definition, so it
81- isn't underfoot when it isn't needed."
81+ isn't underfoot when it isn't needed.
82+
83+ Usage: (examples name-being-tested
84+ expr1
85+ expected-result1
86+ expr2
87+ expected-result2
88+ ...)
89+
90+ Expected results are optional. When provided, they can remind you when
91+ documentation goes out of date. To avoid printing and checking them, use an _
92+ wildcard. For example:
93+
94+ (examples foo
95+ (foo x)
96+ _
97+ (foo y z)
98+ _)
99+
100+ Expected results are compared directly, without evaluation. For example:
101+
102+ (def foo (a b c)
103+ (list a b c))
104+
105+ (examples foo
106+ (foo 1 2 3)
107+ (1 2 3)) <-- no quote
108+
109+ If the result is an object that read can't handle, use valueof. For example:
110+
111+ (examples foo
112+ (foo x)
113+ (valueof (obj a x)))"
82114 `(sref examples* ',tests-and-expected-results ',name))
83115
84116(mac do args
Original file line number Diff line number Diff line change 7777 (if (isa x 'string)
7878 (do (write x) (prn))
7979 (prn x)))
80-
81- (def fns ((o test))
82- " Print sigs for macros & functions whose names (as symbols) match `test'.
83- If `test' is a function, it is used as a predicate.
84- Otherwise, names of which `(string test)' is a prefix pass. "
85- (let test (if (isa test 'fn) test
86- (let pfx string.test [begins string._ pfx]))
87- (each f (sort < (keep test keys.sig*))
88- (pr (helpstr sym.f nil)))))
You can’t perform that action at this time.
0 commit comments