Hi Stephane,

<< What would be the best solution to get rid of the empty strings ? (or of
any
empty values of a block, be they string or of any type? Could you give me a
pointer to the explanation of this in the official doc ? >>

I don't know if this is the best solution, but it's nice and general:

remove-if: func [predicate blk args /local result keep-it][
    result: make block! length? blk
    repeat el blk [
        ; Have to use a temp variable here. "if" doesn't like "predicate :el
args"
        ; inline and putting it in parens breaks the evaluation.
        keep-it: not predicate :el args
        if keep-it [append/only result :el]
    ]
    return result
]

>> remove-if :empty? ["" "A" "B" "" "C" "D" ""] none
== ["A" "B" "C" "D"]

--Gregg

-- 
To unsubscribe from this list, please send an email to
[EMAIL PROTECTED] with "unsubscribe" in the 
subject, without the quotes.

Reply via email to