I want to keep a quotation as a member of a tuple in Factor. But when I try to execute 'call' on it I get the error 'cannot apply call to a run-time computed value'. Note that marking the functions as 'inline' does nothing.
Sample code:
USING: accessors kernel ;
IN: stackoverflow
TUPLE: quottuple quot ;
C: <quottuple> quottuple
: call-quot ( quottuple -- result )
quot>> call ; inline
: main ( -- )
[ 1 ] <quottuple>
call-quot drop ;
MAIN: main
The answer is the 'call(' word. That word requires you to specify the stack effect of the quotation, but as a result the quotation doesn't need to be known at compile time.
USING: accessors kernel ;
IN: stackoverflow
TUPLE: quottuple quot ;
C: <quottuple> quottuple
: call-quot ( quottuple -- result )
quot>> call( -- result ) ;
: main ( -- )
[ 1 ] <quottuple>
call-quot drop ;
MAIN: main
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With