patch_seq_while_loop

Function patch_seq_while_loop 

Source
#[unsafe(no_mangle)]
pub unsafe extern "C" fn patch_seq_while_loop(stack: Stack) -> Stack
Expand description

Loop while a condition is true

Pops a body quotation and a condition quotation from the stack. Repeatedly executes: condition quotation, check result (Int: 0=false, non-zero=true), if true then execute body quotation, repeat.

Stack effect: ( ..a cond-quot body-quot โ€“ ..a ) where cond-quot has effect ( ..a โ€“ ..a Int ) and body-quot has effect ( ..a โ€“ ..a )

ยงSafety

  • Stack must have at least 2 values
  • Top must be Quotation (body)
  • Second must be Quotation (condition)
  • Condition quotation must push exactly one Int
  • Body quotation must preserve stack shape