Skip to content

Instantly share code, notes, and snippets.

View caseykneale's full-sized avatar
😴

Casey Kneale caseykneale

😴
  • Massachusetts, USA
View GitHub Profile
@stivenroytman
stivenroytman / spongespek.jl
Created May 3, 2021 18:51
A custom Julia REPL mode that memes back at you in spongebob spek whatever you say.
using ReplMaker
function spongespek(phrase::String)
casecounter = 0
spek = ""
for letter in phrase
casecounter += 1
if casecounter % 2 == 1
spek *= uppercase(letter)
else
@brenhinkeller
brenhinkeller / lispmode.jl
Last active January 31, 2025 02:17
Bare-bones REPL for Julia's built-in S-expression syntax, in under 30 lines
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