(1) re-wrote some, not yet all, of the brief definitions to BE LIKE VERB PHRASES of a HUMAN LANGUAGE, and
Code: Select all
(define (hh (target 'help) , command_lst syntax)
(set 'command_lst '(
("help" "syntax: (hh command) or (hh top)")
("zero?" "syntax: (zero? expr) -- check if expr evaluates to 0")
("xml-type-tags" "syntax: (xml-type-tags [expr-text-tag expr-cdata-tag expr-comment-tag expr-element-tags]) --> suppress or replace tags in output o
f following xml-parse")
("xml-parse" "syntax: (xml-parse which_string-xml [int-options into_target_sym-ontext [with_func-callback]]) --> ret. parsed Ss-expr list")
("xml-error" "syntax: (xml-error) --> list of err from last xml-parse")
..............
..............
..............
("lists" "syntax: (+, -, *, /,%, <, >, =, <=, >=, !=, :, and, append, apply, args, assoc, assoc-set, begin, bind, case, catch, chop, clean, cond, co
ns, constant, count, curry, define, define-macro, def-new, difference, doargs, dolist, dostring, dotimes, dotree, do-until, do-while, dup, ends-with,
exists, eval, expand, first, filter, find, find-all, flat, fn, for, for-all, if, index, intersect, lambda, lambda-macro, last, length, let, letex, let
n, list, local, lookup, map, match, member, not, nth, nth-set, or, pop, pop-assoc, push, quote, ref, ref-all, ref-set, rest, replace, replace-assoc, r
everse, rotate, select, set, setq, set-assoc, set-nth, set-ref, set-ref-all, silent, slice, sort, starts-with, swap, unify, unique, unless, until, whe
n, while)" )
("strings" "syntax: (.. address, append, char, chop, dup, ends-with, encrypt, eval-string, explode, find, first, float, format, get-char, get-float,
get-int, get-long, get-string, int, join, last, lower-case, member, name, nth, nth-set, pack, parse, pop, push, regex, replace, rest, reverse, rotate
, select, set-nth, slice, source, starts-with, string, sym, title-case, trim, unicode, unpack, upper-case, utf8, utf8len..)")
("math" "syntax: (.. abs, acos, acosh, add, asin, asinh, atan, atanh, atan2, beta, betai, binomial, ceil, cos, cosh, crc32, crit-chi2, crit-z, dec,
div, erf, exp, factor, fft, floor, flt, gammai, atan, gcd, ifft, inc, log, min, max, mod, mul, pow, round, sequence, series, sgn, sin, sinh, sqrt, sub
, tan, tanh..)")
("matrix" "syntax: (.. det, invert, mat, multiply, transpose..)")
("array" "syntax: (.. append, array, array-list, array?, det, first, invert, last, mat, multiply, nth, nth-set, rest, set-nth, transpose..)")
("bit" "syntax: (.. <<, >>, &, |, ^, ~..)")
("predicates" "syntax: (.. array?, atom?, context?, directory?, empty?, file?, float?, global?, integer?, lambda?, legal?, list?, macro?, NaN?, nil?
, null?, number?, primitive?, protected?, quote?, string?, symbol?, true?, zero?..)")
("time-date" "syntax: (.. date, date-value, parse-date, now, time, time-of-day..)")
("stats" "syntax: (.. amb, bayes-query, bayes-train, normal, prob-chi2, prob-z, rand, random, randomize, seed..)")
("patterns" "syntax: (.. ends-with, find, find-all, match, parse, regex, replace, search, starts-with, unify..)")
("financial" "syntax: (.. fv, irr, nper, npv, pv, pmt..)")
("io" "syntax: (.. append-file, close, command-line, copy-file, device, exec, load, open, peek, print, println, read-buffer, read-char, read-file, r
ead-key, read-line, save, search, seek, write-buffer, write-char, write-file, write-line..)")
("unix" "syntax: (.. !, destroy, exec, fork, pipe, process, semaphore, share, wait-pid..)")
("file" "syntax: (.. change-dir, copy-file, delete-file, directory, file-info, make-dir, real-path, remove-dir, rename-file..)")
("http" "syntax: (.. base64-enc, base64-dec, delete-url, get-url, put-url, post-url, xml-error, xml-parse, xml-type-tags..)")
("sockets" "syntax: (.. net-accept, net-close, net-connect, net-error, net-eval, net-listen, net-local, net-lookup, net-peer, net-peek, net-ping, ne
t-receive, net-receive-from, net-receive-udp, net-select, net-send, net-send-to, net-send-udp, net-service, net-sessions..)")
("lisp-system" "syntax: (.. $, callback, catch, context, debug, default, delete, env, error-event, error-number, exit, global, import, main-args, ne
w, ostype, pretty-print, reset, set-locale, signal, sleep, sym, symbols, sys-error, sys-info, timer, throw, throw-error, trace, trace-highlight..)")
("libraries" "syntax: (.. address, flt, float, get-char, get-float, get-int, get-long, get-string, import, int, pack, unpack..)")
("lisp-internals" "syntax: (.. cpymem, dump..)")
("top" "syntax: (lists strings math matrix array bit predicates time-date stats patterns financial io unix file http sockets lisp-system libraries l
isp-internals)")
(set 'syntax (map last (filter (fn (z) (= (z 0) (string target))) command_lst)))
(if syntax
(println (join syntax "\n"))
(println "No help for that command")
)
(string target)
)
It does not wrap in the normal xterm window, of course, and so looks neat and readable, too