Created
September 21, 2010 02:00
-
-
Save vito/589053 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if: a? | |
then: { a } | |
else: { | |
if: b? | |
then: { b } | |
else: { c } | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
condition: { | |
a? -> a | |
b? -> b | |
otherwise -> c | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
condition: (b: Block) := | |
if: b contents empty? | |
then: { raise: "condition: no branches are true" } | |
else: { | |
es = b contents | |
[c, e] = es head targets | |
check = c evaluate-in: b context | |
if: check | |
then: { e evaluate-in: b context } | |
else: { condition: (Block new: es tail in: b context) } | |
} | |
otherwise := True |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- from: | |
if: h tag empty? | |
then: { c } | |
else: { | |
if: (c empty? && (Self-Closing contains?: h tag)) | |
then: { "<" .. h tag .. attrs .. " />" } | |
else: { | |
"<" .. h tag .. attrs .. ">" .. c .. "</" .. h tag .. ">" | |
} | |
} | |
-- to: | |
condition: { | |
h tag empty? -> c | |
c empty? && (Self-Closing contains?: h tag) -> | |
"<" .. h tag .. attrs .. " />" | |
otherwise -> | |
"<" .. h tag .. attrs .. ">" .. c .. "</" .. h tag .. ">" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment