|
Subject: Re: mapping (Was: Re: [xsl] Re: . in for) From: naha@xxxxxxxxxx Date: Fri, 11 Jan 2002 13:34:43 -0500 (EST) |
Quoting Joerg Pietschmann <joerg.pietschmann@xxxxxx>:
[...]
> When discussing operators which take multiple sequences as operands,
> one has to decide whether the lambda iterates over the sequences
> in parallel (as the various map* functions in LISP do) or whether
> it iterates over the cartesian product (as DB table joins to).
> Having similar syntax for both can be confusing.
> BTW expressing a join in LISP with established functionality
> would probably look like
> (defun map-join (expr seq1 seq2)
> (mapcar '(lambda (arg1)
> (mapcar '(lambda (arg2) (funcall expr arg1 arg2))
> seq2)
> seq1))
> Can one of the experts confirm this? It's been a while since i
> was active...
Almost. (map-join '+ '(1 2 3) '(10 20))
would give you
((11 21) (12 22) (13 23))
which probably has one more level of nesting than you'd expect for
a join operation. To achieve that, you'd need to replace the outermost
MAPCAR in MAP-JOIN with the sibling of MAPCAR that combines using
APPEND or NCONC rather than CONS. I'll not take the trouble to look it
up right now.
[...]
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Re: mapping (Was: Re: [xsl] Re: . i, Jeni Tennison | Thread | Re: mapping (Was: Re: [xsl] Re: . i, Joerg Pietschmann |
| [xsl] using Xpath predicate to filt, Chris Pearson | Date | Re: [xsl] Selecting first descendan, Wendell Piez |
| Month |