(phixonline)--> with javascript_semantics -- comparing a simple implementation against using the builtins: sequence stack = {} procedure push_(object what) stack = append(stack,what) end procedure function pop_() object what = stack[$] stack = stack[1..$-1] return what end function function empty_() return length(stack)=0 end function ?empty_() -- 1 push_(5) ?empty_() -- 0 push_(6) ?pop_() -- 6 ?pop_() -- 5 ?empty_() -- 1 ?"===builtins===" requires("1.0.2") -- (latest bugfixes, plus top renamed as peep, for p2js) integer sid = new_stack() ?stack_empty(sid) -- 1 push(sid,5) ?stack_empty(sid) -- 0 push(sid,6) --?peep(sid) -- 6 (leaving it there) ?pop(sid) -- 6 ?pop(sid) -- 5 ?stack_empty(sid) -- 1