pberck@kub.nl (Peter Berck) (04/09/91)
I know it's a long shot, but does anyone know what this does: (........ (AND (STRING-EQUAL (STRING-CADR L) "j") (zl:MEM #'STRING-EQUAL (STRING-CAR (STRING-LAST MEM)) '("e" "a" "o")))))) I am 'translating' a program written in ZetaLisp for someone, and I am not sure what (zl:MEM ... ..) does, because I don't have the zl package. He is away for a week, so I can't ask him, ... so I am trying it this way. it looks like some sort of mapping function (?). MEM is (also) a variable defined in the DO loop where this happens... thanks for any help -peter -------------------------------------- pberck@kub.nl - kubvx1::berckp
rkf@INEL.GOV (Raymond K. Fink) (04/10/91)
In article <1991Apr09.110422.19604@kub.nl>, pberck@kub.nl (Peter Berck) writes: >I know it's a long shot, but does anyone know what this does: >(........ > (AND (STRING-EQUAL (STRING-CADR L) "j") > (zl:MEM #'STRING-EQUAL > (STRING-CAR (STRING-LAST MEM)) '("e" "a" "o")))))) > I don't *know*, but it looks suspiciously like a set membership test, using #'string-equal to test (string-car ..etc..) against elements of the list '("e" "a" "o"). The interesting question is what does zl:MEM return when it finds a match, e.g. does it behave like SOME, FIND, or MEMBER ? Ray Fink -- Idaho National Engineering Laboratory -- Idaho Falls ID rkf@inel.gov 208-526-9323 ========== long legal disclaimer follows, press n to skip =========== Neither the United States Government or the Idaho National Engineering Laboratory or any of their employees, makes any warranty, whatsoever, implied, or assumes any legal liability or responsibility regarding any information, disclosed, or represents that its use would not infringe privately owned rights. No specific reference constitutes or implies endorsement, recommendation, or favoring by the United States Government or the Idaho National Engineering Laboratory. The views and opinions expressed herein do not necessarily reflect those of the United States Government or the Idaho National Engineering Laboratory, and shall not be used for advertising or product endorsement purposes.
mitchell@tartarus.uchicago.edu (Mitchell Marks) (04/10/91)
I don't know about Zetalisp, but this MEM seems similar to what T has. It's similar to MEMQ or MEMBER, but the first arg provides the comparator (equivalence) function used to test membership. -- Mitch Marks mitchell@cs.UChicago.EDU --But...but...I can see with my own two eyes that it's... --Hey, who're you gonna believe: *me* or your own two eyes?
michaelg@neon.Stanford.EDU (Michael Greenwald) (04/10/91)
pberck@kub.nl (Peter Berck) writes: >I know it's a long shot, but does anyone know what this does: >(........ > (AND (STRING-EQUAL (STRING-CADR L) "j") > (zl:MEM #'STRING-EQUAL > (STRING-CAR (STRING-LAST MEM)) '("e" "a" "o")))))) >I am 'translating' a program written in ZetaLisp for someone, and I am >not sure what (zl:MEM ... ..) does, because I don't have the zl >package. He is away for a week, so I can't ask him, ... so I am trying >it this way. (ZL:MEM pred item list) is just like ZL:MEMQ, except that it uses the two argument pred for comparison instead of EQ. (Or you could say that it is just like MEMBER, except it takes a predicate instead of EQL). By the way, MEMQ is from MACLISP, so it isn't such a "long shot". Anyway, MEM returns NIL if "item" isn't in "list" according to "pred". If item >is< in the list, then MEM returns the first CONS with something matching item as its CAR (or, as they say, "the SUBLIST starting with ITEM") If ZL:MEM shows up someplace else, and has a non-commutative pred (like #'char-lessp), then you should know "item" is always the first argument passed to pred. >it looks like some sort of mapping function (?). MEM is (also) a >variable defined in the DO loop where this happens... >thanks for any help >-peter >-------------------------------------- >pberck@kub.nl - kubvx1::berckp
barmar@think.com (Barry Margolin) (04/10/91)
In article <1991Apr09.110422.19604@kub.nl> pberck@kub.nl writes: >I am 'translating' a program written in ZetaLisp for someone, and I am >not sure what (zl:MEM ... ..) does, because I don't have the zl >package. He is away for a week, so I can't ask him, ... so I am trying >it this way. (ZL:MEM predicate item list) is equivalent to (MEMBER item list :TEST predicate) In Zetalisp, MEMQ used EQ, MEMBER used EQUAL, and MEM used a caller-supplied test function. -- Barry Margolin, Thinking Machines Corp. barmar@think.com {uunet,harvard}!think!barmar