Skip to content

Instantly share code, notes, and snippets.

@vito
Created September 6, 2010 15:23
Show Gist options
  • Save vito/567155 to your computer and use it in GitHub Desktop.
Save vito/567155 to your computer and use it in GitHub Desktop.
Atomo's pretty printer
v match: (b: <self>) :=
if: b contents empty? then: { @no-match } else: { es = b contents;
[p, e] = es head targets;
match = (p as: Pattern) matches?: v;
if: (match == @no) then: { v match: (Block new: es tail in: b scope) } else: { @(yes: obj) = match;
obj join: (Block new: [e] in: b scope) } }
v match: (b: <self>) :=
if: b contents empty?
then: { @no-match }
else: { es = b contents;
[p, e] = es head targets;
match = (p as: Pattern) matches?: v;
if: (match == @no)
then: { v match: (Block new: es tail in: b scope) }
else: { @(yes: obj) = match;
obj join: (Block new: [e] in: b scope) } }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment