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

Re: Recursive definitions of higher-order operators



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>>)