[REBOL] Re: REBOL Cookbook in Beta
From: nitsch-lists:netcologne at: 3-Sep-2003 20:14
Am Mittwoch, 3. September 2003 00:06 schrieb Michael J. Mastroianni:
> Hi Gregg,
>
..
> That said, aside from well-designed functions
> that work well together, or maybe the OO stuff
> that I don't fully appreciate yet in REBOL,
> what *is* that paradigm or structure that would
> provide the clean utility of a pipe ? Perhaps
> this is best implemented as an enhancement to REBOL,
> as I believe the idea of a pipe is *very* elegant
> and conducive to problem-solving in a way
> that is very light and natural to understand.
>
> Maybe the way ports are implemented in REBOL would
> provide a means to implement pipe-like functionality.
>
> When you break it down, REBOL *has* all the "stuff"
> that you need to take data, transform it, transform it
> again, and again, etc., ad nauseum until you get the
> desired result. The problem for me is that instead
> of seeing a clear linear flow of data transformations
> that a pipe approach reveals, you end up with nested
> transformations that might tend to obscure what you're
> trying to accomplish. I.e., sort of the difference
> between the following ideas
>
> a < data | b | c | d | e | f > outfile
>
> and
>
> write f(e(d(c(b(a(data))))))
>
> I prefer the first for clarity, given my experiences
> with the pipe idea.
>
You nearly got functional programming.
Only you use postfix, rebol prefix.
that means
read stuff | process | write stuff
becomes
write stuff process read stuff
you may need parents while learning. or:
|: func ["simply return value" v [any-type!]] [get/any 'v]
write stuff | process | read stuff
-Volker