Skip to content

Instantly share code, notes, and snippets.

View wofockham's full-sized avatar
💭
raging at Microsoft

wofockham

💭
raging at Microsoft
View GitHub Profile
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>static.</title>
<link rel="stylesheet" href="static.css">
<script src="static.js"></script>
</head>
<body>
@env = { :label => proc { |(name,val), _| @env[name] = eval(val, @env) },
:car => lambda { |(list), _| list[0] },
:cdr => lambda { |(list), _| list.drop 1 },
:cons => lambda { |(e,cell), _| [e] + cell },
:eq => lambda { |(l,r), ctx| eval(l, ctx) == eval(r, ctx) },
:if => proc { |(cond, thn, els), ctx| eval(cond, ctx) ? eval(thn, ctx) : eval(els, ctx) },
:atom => lambda { |(sexpr), _| (sexpr.is_a? Symbol) or (sexpr.is_a? Numeric) },
:quote => proc { |sexpr, _| sexpr[0] } }.merge(ext)