On Tue, 23 Nov 1999 [EMAIL PROTECTED] wrote:

> We can do the problems in a purely functional manner.
> Although it is possible to write a FILTER function in a purely
> functional manner (provided you use prepend) 
-- snip 

What exactly is wrong with this version of filter?

filter: func [f blk] [
        if tail? blk [return copy []]
        if f first blk [return append filter :f next blk first blk]
        return filter :f next blk
]

Or I guess this is in a more functional style:

filter: func [f blk] [
        either tail? blk [
                copy []
        ] [
                either f first blk [
                        append filter :f next blk first blk
                ] [
                        filter :f next blk
                ]
        ]
]


Gisle

Reply via email to