what happened to 'ev' ?




On Fri, 28 Aug 2009, Stavros Macrakis wrote:

< The core problem here is that the 'option' argument of s_list uses the
< literal free variable 'x' in the condition.
< 
< The 'lambda([x],...)' construction used in sublist has far cleaner semantics
< that the arbitrary free variable 'x' being used to represent the argument,
< so I would strongly recommend sticking to sublist.
< 
< If it is so important to save a few keystrokes at the cost of anomalous
< semantics, the better way to define s_list is as a macro (using ::=).  But I
< don't recommend that.
 
As a macro:

(%i2) slist(l,o,[varname]) ::= buildq([l,o,v:if varname=[] then 'x else
part(varname,1)], sublist(l,lambda([v],is(o))))$
(%i3) slist([1,2,4,6],x<4);
(%o3) [1,2]
(%i4) slist([1,2,4,6],t<4);
(%o4) [1,2,4,6]
(%i5) slist([1,2,4,6],t<4,t);
(%o5) [1,2]
(%i6) slist([1,2,4,6],t<4 and t>1,t);
(%o6) [2]

I'm curious to know why you don't recommmend this.

Leo

-- 
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.