[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Recursive definitions of higher-order operators

You should not rely on a bug.  This is specification, not Unix programming.


On Sunday, December 6, 2015 at 1:15:36 PM UTC-8, Y2i wrote:
I'm just curious if it is OK to rely on this feature or not?

It's getting really handy, like in the operator below that removes sequence elements that satisfy some condition:

RECURSIVE RemoveElems(_,_)

RemoveElems(COND(_), q) ==

    IF q = <<>> THEN <<>>

    ELSE LET h == Head(q)

         IN  IF COND(h) 

                 THEN RemoveElems(COND, Tail(q)) 

                 ELSE <<h>> \o RemoveElems(COND, Tail(q))

LLL == RemoveElems(LAMBDA x : x = 4, <<5,3,6,7,4,3,4,5,7,8,2,1>>)