xsl-list
[Top] [All Lists]

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

2012-10-29 17:14:33
On Mon, Oct 29, 2012 at 2:50 PM, Costello, Roger L. 
<costello(_at_)mitre(_dot_)org> 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



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--




-- 
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.

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>