Re: [xsl] [XPath 3.0] How to do partial function application on the min() function?

Subject: Re: [xsl] [XPath 3.0] How to do partial function application on the min() function?
From: Dimitre Novatchev <dnovatchev@xxxxxxxxx>
Date: Mon, 29 Oct 2012 15:14:03 -0700
On Mon, Oct 29, 2012 at 2:50 PM, Costello, Roger L. <costello@xxxxxxxxx> wrote:
> Hi Folks,
>
> I would like to fix one argument of the min() function to 2 and leave the other argument undefined, thus producing a partially applied function. Then, I would like to give the partially applied function a value. Here's what I tried:
>
>             let $min2 := min((?,2))
>             return $min2(3)
>
> I get this error: Unexpected token "?" in path expression

Min has a single argument, which is a sequence.  Therefore:

>             let $min2 := min((?,2))

isn't correct, indeed, because the argument placeholder doesn't
substitute the whole and only argument of the function.

It seems to me the what you want is:

          let $min2 := $compose(min#1, $makeSequence(?,2))
            return
               $min2(3)

where $compose should be similar to what was already discussed in this
list a few days ago and $makeSequence() must be essentially the same
as LISP's cons() funxction.


Cheers,

Dimitre



>
> What's the correct way to accomplish this?
>
> /Roger
>



-- 
Cheers,
Dimitre Novatchev
---------------------------------------
Truly great madness cannot be achieved without significant intelligence.
---------------------------------------
To invent, you need a good imagination and a pile of junk
-------------------------------------
Never fight an inanimate object
-------------------------------------
To avoid situations in which you might make mistakes may be the
biggest mistake of all
------------------------------------
Quality means doing it right when no one is looking.
-------------------------------------
You've achieved success in your field when you don't know whether what
you're doing is work or play
-------------------------------------
Facts do not cease to exist because they are ignored.
-------------------------------------
Typing monkeys will write all Shakespeare's works in 200yrs.Will they
write all patents, too? :)
-------------------------------------
I finally figured out the only reason to be alive is to enjoy it.

Current Thread