[REBOL] Antwort: Antwort: Rebol Bug-List Re:(4)
From: joel:neely:fedex at: 13-Oct-2000 12:10
Hi, Sharriff,
[Sharriff--Aina--med-iq--de] wrote:
> Isīnt this the same as defining an unamed function without arguments?
>
> Sharriff Aina
> med.iq information & quality in healthcare AG
> Gutenbergstr. 42
> 41564 Kaarst
> tel.: 02131-3669-0
> fax: 02131-3669-599
> www.med-iq.de
>
Yes.
>> source does
does: func [
{Defines a function that has no arguments or locals.} [catch]
body [block!] "The body block of the function"
][
throw-on-error [make function! [] body]
]
The same effect can be obtained a couple of ways.
>> greet: does [print "Hi, Sharriff"]
>> greet
Hi, Sharriff
>> greet: to-paren [print "Hi, Sharriff"]
== (print "Hi, Sharriff")
>> greet
Hi, Sharriff
>> greet: func [] [print "Hi, Sharriff"]
>> greet
Hi, Sharriff
>> greeting: [print "Hi, Sharriff"]
== [print "Hi, Sharriff"]
>> do greeting
Hi, Sharriff
It would be interesting to see what tradeoffs exist among these
various approaches. YMMV.
-jn-
--
; Joel Neely [joel--neely--fedex--com] 901-263-4460 38017/HKA/9677
REBOL [] do [ do func [s] [ foreach [a b] s [prin b] ] sort/skip
do function [s] [t] [ t: "" foreach [a b] s [repend t [b a]] t ] {
| e s m!zauafBpcvekexEohthjJakwLrngohOqrlryRnsctdtiub} 2 ]