select all x in L



On 5/23/07, Wolfgang Lindner <LindnerW at t-online.de> wrote:
>
> The Derive code is:
>                      H(a, v_) := DIM(SELECT(x = a, x, v_))
> Q1: is there a predefined function 'select' (with another name?) in Maxima
>     I have overlooked?
> Q2: I would like to have a 'more functional and general' version of
> select.
>     Does a member of the Maxima community has some hints?
>

    sublist( list, lambda([x],x=a) )

If you prefer makelist-like syntax (as in Derive), you can define a macro:

    make_sublist ( pred, var, list) ::=
          buildq( [pred,var,list], sublist( list, lambda([x],x=a) )$

Is this what you had in mind?

           -s