macro ( ('let x y) ) ( (λ x . ()) y ); macro ( ('for-each (item 'in iter) loop) ) ( (let (uuid iter-term) iter) (while (non-zero (uuid iter-term)) (match (uuid iter-term) ( () ( (LCons( item (uuid iter-rst) )) ( loop (set (uuid iter-term) (uuid iter-rst)) )) ))) ); macro ('match t ps) (scope( (let (uuid term) (open t)) (match-pats( (uuid term) ps (fail( 'Pattern\sMatch\sFailure_s (: (p :Location:) Constant+Literal+String) )) )) )); macro ('match-pats( term () remainder )) ( remainder ); macro ('match-pats( term (ps (lhs rhs)) remainder )) ( (match-pats( term ps (scope(if (match-pats-arm( term lhs )) rhs remainder)) )) ); macro ('match-pats-arm( term (:Variable: v) )) ( ( (let v term) (branchtrue()) ) ); macro ('match-pats-arm( term ('@( v more )) )) ( ( (let v term) (match-pats-arm( v more )) ) ); macro ('match-pats-arm( term :Any: )) ( (branchtrue()) ); macro ('match-pats-arm( term (:Literal: l) )) ( ( (let (uuid v) term) (==( (uuid v) l )) ) ); macro ('match-pats-arm( term (:Tag: l lt) )) ( ( (let (uuid v) term) (==( (.0( (uuid v) )) l )) ) ); macro ('match-pats-arm( term ((:Tag: l lt) ( x1 )) )) ( ( (let (uuid v) term) (let (uuid m) 0_u8) (if (==( (.0( (uuid v) )) l )) (if (match-pats-arm( (open(.1( (as (uuid v) lt) ))) x1 )) (set (uuid m) 1_u8) () ) () ) (==( (uuid m) 1_u8 )) ) ); macro ('match-pats-arm( term ((:Tag: l lt) ( x2 x1 )) )) ( ( (let (uuid v) term) (let (uuid m) 0_u8) (if (==( (.0( (uuid v) )) l )) (if (match-pats-arm( (open(.1( (as (uuid v) lt) ))) x1 )) (if (match-pats-arm( (open(.2( (as (uuid v) lt) ))) x2 )) (set (uuid m) 1_u8) () ) () ) () ) (==( (uuid m) 1_u8 )) ) ); macro ('match-pats-arm( term ((:Tag: l lt) ( x3 x2 x1 )) )) ( ( (let (uuid v) term) (let (uuid m) 0_u8) (if (==( (.0( (uuid v) )) l )) (if (match-pats-arm( (open(.1( (as (uuid v) lt) ))) x1 )) (if (match-pats-arm( (open(.2( (as (uuid v) lt) ))) x2 )) (if (match-pats-arm( (open(.3( (as (uuid v) lt) ))) x3 )) (set (uuid m) 1_u8) () ) () ) () ) () ) (==( (uuid m) 1_u8 )) ) ); macro ('match-pats-arm( term ((:Tag: l lt) ( x4 x3 x2 x1 )) )) ( ( (let (uuid v) term) (let (uuid m) 0_u8) (if (==( (.0( (uuid v) )) l )) (if (match-pats-arm( (open(.1( (as (uuid v) lt) ))) x1 )) (if (match-pats-arm( (open(.2( (as (uuid v) lt) ))) x2 )) (if (match-pats-arm( (open(.3( (as (uuid v) lt) ))) x3 )) (if (match-pats-arm( (open(.4( (as (uuid v) lt) ))) x4 )) (set (uuid m) 1_u8) () ) () ) () ) () ) () ) (==( (uuid m) 1_u8 )) ) ); macro ('match-pats-arm( term ((:Tag: l lt) ( x5 x4 x3 x2 x1 )) )) ( ( (let (uuid v) term) (let (uuid m) 0_u8) (if (==( (.0( (uuid v) )) l )) (if (match-pats-arm( (open(.1( (as (uuid v) lt) ))) x1 )) (if (match-pats-arm( (open(.2( (as (uuid v) lt) ))) x2 )) (if (match-pats-arm( (open(.3( (as (uuid v) lt) ))) x3 )) (if (match-pats-arm( (open(.4( (as (uuid v) lt) ))) x4 )) (if (match-pats-arm( (open(.5( (as (uuid v) lt) ))) x5 )) (set (uuid m) 1_u8) () ) () ) () ) () ) () ) () ) (==( (uuid m) 1_u8 )) ) );