Skip to content

Instantly share code, notes, and snippets.

@Idorobots
Created August 10, 2012 07:15
Show Gist options
  • Save Idorobots/3312154 to your computer and use it in GitHub Desktop.
Save Idorobots/3312154 to your computer and use it in GitHub Desktop.
ASM code sample
#; ASM code sample**
#; Extend the language however you please.
(syntax (Ternary < Expression (: "\\?") Expression (: ":") Expression)
`($(car Ternary)
($(ternary-to-if (caadr Ternary)))))
#; Use the whole language to your advantage.
(function (ternary-to-if t)
`(if $(car t)
$(cadr t)
$(caddr t)))
#; Interaction with the rest of the grammar is well-defined.
#; No more hard to find bugs!
(syntax (Expression < (/ Quote Tuple Vector String Ternary Atom))
#; It's that simple!
(function (abs x)
(> 0 x) ? (- x) : x )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment