[REBOL] Re: make <object-type> append
From: gjones05:mail:orion at: 14-Jun-2001 8:37
From: "Joel Neely"
> Forgive me if I insult your intelligence by
> proceeding in very small steps; that's just
> my own style for picking apart the pieces
> of a puzzle with several components, so
> it's about me and not about you.
Hi, Joel,
One has to have intelligence, in order for the intelligence to be insulted!
;-)
The stepwise approach serves as a type of assertion checking for erroneous
assumptions. If PeKr had not beat you to the Send key, your explanation would
have guaranteed that I understood. Thanks for taking the time. Just a couple
more comments for your edification...
...
> I have no idea *why* one would APPEND two literal blocks before
> supplying them as a spec for MAKE (instead of simply writing
> their content as a single block), but I hope the above makes
> it more clear *what* is happening:
Yes, it does. I left out the context in which RT uses this method, but I'll
explain further below.
...
> AFAICT, you can use any expression that constructs a correctly-
> formed block to supply the second (spec) argument to MAKE. e.g.:
For some reason I developed a mental block (a stuttering paradigm shift?). I
had it in my head that this construct was some special form of make!, forgetting
that append is just passing along the second parameter (the spcification, in
this case). Like I said to PeKr, it is embarrassingly obvious now. I am always
glad to learn, so it was worth it.
...
> That just happens to be a particularly awkward way to do it! ;-)
The context in which RT used this construct was to conditionally pass another
specification to the make.
Here is the snippet:
HTTP-Get-Header: make HTTP-Get-Header append [
Referer: either find port/url #"?" [head clear find copy port/url #"?"]
[port/url]
Content-Type: "application/x-www-form-urlencoded"
Content-Length: length? post-data/2
] either block? post-data/3 [post-data/3] [[]]
This was slightly shorter than using a second conditional make, like:
HTTP-Get-Header: make HTTP-Get-Header [
Referer: either find port/url #"?" [head clear find copy port/url #"?"]
[port/url]
Content-Type: "application/x-www-form-urlencoded"
Content-Length: length? post-data/2
]
if block? post-data/3 [
HTTP-Get-Header: make HTTP-Get-Header [
post-data/3
]
I guess I am still getting used to the functional aspect of functional
programming. It is happening less often.
Thanks again for the thorough discussion.
--Scott Jones