Created
August 10, 2010 22:29
-
-
Save vito/518132 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
#title:{The} | |
hello! | |
#bold:{Hello, there. #bold:{My name is Inigo Monyoya}.} | |
goodbye! | |
#interaction:({ | |
1 + 1 | |
6 * 7 | |
5.0 / 2.0 | |
}) | |
#interaction:({ | |
a = 1 | |
a | |
}) |
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
hello! | |
<string>Hello, there. <string>My name is Inigo Monyoya</strong>.</strong> | |
goodbye! | |
<pre>> (1 + 1) | |
2 | |
> (6 * 7) | |
42 | |
> (5.0 / 2.0) | |
2.5 | |
</pre> | |
<pre>> <top> a = 1 | |
> a | |
1 | |
</pre> |
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
A = Object clone | |
(a: A) bold: (e: Expression) := | |
a bold: e evaluate (as: String) | |
A bold: (s: String) := | |
"<string>" .. s .. "</strong>" | |
A interaction: (e: Expression) := { | |
-- pseudo environment for evaluating the expressions | |
env = Object clone | |
log = e evaluate contents (map: { e | | |
if: ((e type == @define) || (e type == @set)) | |
then: { | |
env do: (Block new: [e]) evaluate | |
"> " .. (e as: String) .. "\n" | |
} | |
else: { | |
res = env join: (Block new: [e]) evaluate | |
"> " .. (e as: String) .. "\n" .. (res as: String) .. "\n" | |
} | |
}) concat | |
"<pre>" .. log .. "</pre>" | |
} call |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment