List X contains element W. How do I get the corresponding element from list Y of the same length?

Submitted by javelin on Sun, 2012-02-12 22:05

List X contains element W. How do I get the corresponding element from list Y of the same length?

Take your pick:

extract(Y,member(X,W),1)
elements(Y,member(X,W))

2001-Mar-28 9:55am dunemush

This also works:

  
[set(me,uh_temp:W)][munge(uh_temp,X,Y)]

This can be useful when W is produced by a u() call w/o arguments (you can get rid of the set() and just use the name of the u()\\\\\\\\\\\\\\\'d attribute in place of uh_temp).

2001-Mar-28 11:05am popiel