1.19 pattern example 14

Write pattern to pick all elements from list which are not integers.

L:=[a, b, 0, 1, 2, x, y]: 
map( proc(X) local la,x; 
     if patmatch(X, conditional( x::anything, not _type(x,integer) ),'la') then 
        eval(x,la); 
     else 
        NULL; 
     fi; 
     end proc, L 
    ); 
 
     [a, b, x, y]
 

This can also be done without pattern matching like this

select(not type,L,integer) 
 
      [a, b, x, y]
 

In Mathematica

Cases[{a, b, 0, 1, 2, x, y}, Except[_Integer]] 
 
   {a, b, x, y}