Hello,

On #concatenative someone asked about a word to destructively remove elements 
from a sequence which satisfy a quotation.

I added functional and mutating versions of this word to the 'newfx' 
vocabulary:

        purge  ( seq quot -- seq )
        purge! ( seq quot -- seq )

Here's the implementation of each:

: purge ( seq quot -- seq ) [ not ] compose filter ;

: purge! ( seq quot -- seq )
  dupd '[ swap @ [ pluck! ] [ drop ] if ] each-index ;

Let me know if you can improve upon the latter.

Ed

-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
_______________________________________________
Factor-talk mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/factor-talk

Reply via email to