On 6 February 2017 at 20:03, Danilo Kordic <danilo.kor...@gmail.com> wrote:
> Hi Rowan.
> [de help: [Sym Txt]
> [def Sym 'help: Txt] ]
> [help: "`prop'erty is clearly better than a txt in `prg' if it should
> be extracted by a procedure. "
> [de help [Sym]
> "I prefer even this over Reader Comments (``#''). "
> [get Sym 'help:] ] ]
Thanks for that, Danilo. I was a bit confused for a while though
because (I think?) there is a typo in it - it doesn't work for me
as-is. Anyway, your pointing out the use of a property on the function
made sense. I managed to get a version of it working which I like (see
below), particularly because it makes passing in "lambdas" trivial as
a single arg, and is easy to visually parse with that in mind). I
guess the main benefit of using the property-approach is that it won't
have any speed impact on the function when it runs, whereas including
a "docstring" like I was doing will cause the string to be silently
"evaluated" every time the function is run... Just out of curiosity,
is that the main/only reason? or are there other reasons I haven't
thought of? BTW: The version I came up with is:
(de hde (Sym Txt Fn)
(def Sym Fn)
(def Sym 'help: Txt) )
(hde 'help "This is the help function"
'((X) (get X 'help:)) )
(hde 'tester "This is the tester function"
'((X) (println X)) )
-> "This is the tester function"
"A riot is the language of the unheard." - Dr. Martin Luther King
"There is a great difference between worry and concern. A
worried person sees a problem, and a concerned person solves a
problem." - Harold Stephens
"Ignorance requires no apologies when it presents questions
rather than assertions." - Michael Sierchio (OpenSSL mailing list)
"What we need more than an end to wars is an end to the
beginning of all wars." - Franklin Roosevelt