Hi Gerard,

Look at this:

        a: 1
        ;== 1
        
        a         ; you type a word
        ;== 1     ; it is evaluated and result returned
        
        'a        ; you type a lit-word
        ;== a     ; it is evaluated and result returned (a word)
        
        to-lit-word 'a  ; you type a lit-word, it is evaluated to a word
        ;== 'a          ; but then you converted it back to a lit-word


So, in your MY-MAP function below, the 'first lit-word
is converted to a word *before* it is passed to the function.

The solution is to have MY-MAP accept f as a word!, eg:

        my-map: func [f [word!] ...

Anton.

> Being so I tried to add more validation for parameters f and blk  
> as in f [lit-word!] and blk [block!]. To my great surprise I
> received the following error msg. Can someone help me to better 
> understand how REBOL can send me this error ?
> 
> Why is 'first not considered as a real lit-word! datatype! ?
> 
> >> my-map: func [f [lit-word!] blk [block!] /local result] [
> [     result: make block! length? blk
> [     foreach item blk [
> [          append/only result do reduce [:f :item]
> [         ]
> [     result
> [    ]
> >> my-map 'first ["ab" "cd" "ef"]
> ** Script Error: my-map expected f argument of type: lit-word
> ** Where: halt-view
> ** Near: my-map 'first ["ab" "cd" "ef"]
> >>
> 
> Thanks!
> Regards,
> Gerard

-- 
To unsubscribe from the list, just send an email to 
lists at rebol.com with unsubscribe as the subject.

Reply via email to