Block parsing - function! datatype
[1/3] from: pwawood:g:mail at: 21-Jul-2007 17:20
When parsing a block for a function! value, I'm finding the value that
I'm trying to set gets set to [second function] value rather than the
function:
>> a: func [] [12.34]
>> parse [:a] [set b function!]
== false
>> source b
b: [12.34]
Is this the expected behaviour?
My workaround is a bit cumbersome:
>> parse [first :a second :a] [set spec block! set body block!]
== false
>> b: func spec body
>> source b
b: func [/local][12.34]
>> b
== 12.34
Any improvements?
Regards
Peter
[2/3] from: santilli:gabriele:g:mail at: 21-Jul-2007 12:27
2007/7/21, Peter Wood <pwawood-gmail.com>:
> When parsing a block for a function! value, I'm finding the value that
> I'm trying to set gets set to [second function] value rather than the
> function:
>
> >> a: func [] [12.34]
> >> parse [:a] [set b function!]
> == false
Notice the FALSE here!
The block you are parsing contains a get-word not a function.
>> f: func [a] [print a]
>> parse reduce [:f] [set g function!]
== true
>> :g
>> source g
g: func [a][print a]
HTH,
Gabriele.
[3/3] from: pwawood::gmail::com at: 21-Jul-2007 19:00
Gabriele
Yes it helps, thanks.
Regards
Peter
On Saturday, July 21, 2007, at 06:27 pm, Gabriele Santilli wrote: