Skip to content

Instantly share code, notes, and snippets.

View Vaguery's full-sized avatar

Bill Tozier Vaguery

View GitHub Profile
Your random program:
block {
  value «int»
  do code_null_q
  value «int»
  block {
    value «bool»
    do float_sqrt}
  ref x1
( CODE.QUOTE ( INTEGER.POP 1 )
CODE.QUOTE ( CODE.DUP INTEGER.DUP 1 INTEGER.- CODE.DO INTEGER.* )
INTEGER.DUP 2 INTEGER.< CODE.IF )
( 1 2 INT.+ ( 3 4 INT.* ) ( 5 INT.+ ) )
( 1 2 INT.+ ( 3 4 INT.* ) ( 5 INT.+ ) )
( ( 1 ) ( 2 ) INT.+ ( 3 ( ) ( 4 ( ) ) INT.* ) ( 5 ( INT.+ ) ) )
( 1 2 INT.+ 3 4 INT.* 5 INT.+ )
( 1 2 INT.+ 3 4 INT.* 5 INT.+ INT.- )
( 1 2 3 4 5 INT.+ INT.* INT.+ )
( 5 3 4 1 2 INT.+ INT.* INT.+ INT.- )
( INT.+ INT.* INT.+ INT.- 5 3 4 1 2 )
block {
value «int»
value «int»
do int_add
block {
value «int»
value «int»
do int_multiply}
block {
value «int»
block {
value «code»
value «int»
value «foo»}
«code» value «int»
«int» -1
«int» 1000
«bar» whatever I want
it to be, actually
value «code»
«code» block { value «code» value «int» value «foo»}
«code» value «int»
«int» -1
«int» 1000
«bar» whatever I want
it to be, actually
# random sampling (yer basic guesser)
class GuesserWorkstation << Workstation
# 'def receive!' is missing, so execution
# falls back to super
def build!
consecutive :answers do
# class name MUST match /[AnythingCamelCased]Instruction/
class MyNewNudgeInstruction < Instruction
# preconditions? should return true if everything works
#
# use the #needs method for simple argument requirements checking:
# test will pass if there are at least that many items on the named stack(s)
def preconditions?
needs :foo, 2