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
using ReplMaker | |
function spongespek(phrase::String) | |
casecounter = 0 | |
spek = "" | |
for letter in phrase | |
casecounter += 1 | |
if casecounter % 2 == 1 | |
spek *= uppercase(letter) | |
else |
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
to_expr(x) = x | |
to_expr(t::Tuple) = Expr(to_expr.(t)...) # Recursive to_expr implementation suggested by Mason Protter | |
lisparse(x) = to_expr(eval(Meta.parse(x))) # Note that the `eval` in here means that any normal (non-s-expression) Julia syntax gets treated a bit like a preprocessor macro: evaluated _before_ the s-expression syntax is compiled and evaluated | |
function lispmode() | |
printstyled("\nlisp> ", color=:magenta, bold=true) | |
l = readline() # READ | |
while l !== "(:exit)" | |
try # So we don't get thrown out of the mode | |
result = eval(lisparse(l)) # EVAL | |
if isa(result, Expr) # PRINT, in s-expression syntax |