|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: mapping (Was: Re: Re: . in for)
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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








