Joel wrote:

[EMAIL PROTECTED] wrote:
>
>> samef: func [f [any-function!]] [func [x] [f x]]
>
> 1. Is the samef expected to return a function? Hint: Yes
>
> 2. Does it really return a function? Hint: No
>

Doesn't it?  Depends on usage, IMHO.

    >> samef: func [f [any-function!]] [func [x] [f x]]
    >> type? (samef add1)
    ** Script Error: add1 is missing its i argument.
    ** Where: samef add1

Looks bad until we add some punctuation...

    >> type? (samef :add1)
    == function!

Alternately, we could let 'samef worry about the punctuation

    >> samef: func [:f [any-function!]] [func [x] [f x]]
    >> type? (samef add1)
    == function!

Or have I missed your point?

-jn-

I must be more specific and explain what did I mean. OK, let's go:

I repeat some of Elan's observations:

>> type? samef :add1
== function!

>> fun: samef :add1
>> source fun
fun: func [........]

>> probe :fun
.....

So there is an obvious decision: fun, or (samef :add1) IS A FUNCTION!

At least, Rebol told it to us.

What about the truth: exactly speaking, the function is a special kind of
relation, where to an argument X from the domain of the relation (you see,
domain, so you don't have to worry about samef add1 as in your example,
because the argument given is surely out of the domain) there is ONLY ONE
value Y from it's range (the result of the function applied to the given
argument) such that Y = f X.

In this sense I must (samef :add1) call a NON-FUNCTION, because according to
Rebol it surely is a function, but you can easily find out that for fixed X
there are lots of Y's such that Y = f X (it was shown in my first mail on
non-re-entrant function calling). Please feel free to ask, if you still
don't know what am I trying to say.

Ladislav

Reply via email to