Let’s say I have
o: context [
f: func[message /refine message2][
print [message]
if refine [print message 2]
]
]
I can call it like this
do get in o 'f "hello"
But how can I do for the refinement ? something like this that would work
>> do get in o 'f/refine "hello" "world"
** Script Error: in expected word argument of type: any-word
** Near: do get in o 'f/refine
>>
I don’t know if there’s a way to directly tell the interpreter to use a refinement in invoking a function value. That would require some parameterization of
dowhen its argument is afunction!Nothing like that seems to exist…but maybe it’s hidden somewhere else.The only way I know to use a refinement is with a path. To make it clear, I’ll first use a temporary word:
What that second statement evaluates to after the compose is:
You can actually put function values into paths too. It gets rid of the need for the intermediary:
P.S. you have an extra space between
messageand2above, where it should just bemessage2