How to call a constructed quotation in Factor

304 views Asked by At

I have a word which constructs a quotation which I want to be called. However, when I load the code I get Cannot apply “call” to a run-time computed value. If I use the walker and step thru the code it executes as expected. How are you supposed to call a constructed quotation?

: ba>struct ( array class -- struct array )
[ <struct> swap ] keep struct-slots
[
    [ type>> to-type ] keep  
    name>> setter-word 1quotation curry
    [ over ] dip  curry  call drop
] each
; 

EDITED: This does work

: ba>struct ( array class -- struct array )
    [ <struct> swap ] keep struct-slots
    [
        [ type>> to-type ] keep  
        name>> setter-word 1quotation curry
        [ over ] dip  curry  call( -- x ) drop
    ] each
    ; 

The problem stems from the runtime not knowing what the stack effect is of a constructed quote. In these cases, you must declare what the stack looks like to the quote for the call.

0

There are 0 answers