Skip to content

Instantly share code, notes, and snippets.

View leinonen's full-sized avatar

Peter Leinonen leinonen

View GitHub Profile
@leinonen
leinonen / lisp.js
Created August 8, 2025 12:52
a small Lisp implementation in javascript
// Data Representation
function isAtom(x) { return typeof x !== 'object' || x === null; }
function isList(x) { return Array.isArray(x); }
// Parser (Converting Text to Data)
function parse(input) {
// Better tokenization that handles multi-line input
let tokens = input.replace(/\(/g, ' ( ')
.replace(/\)/g, ' ) ')
.replace(/\n/g, ' ') // normalize newlines
@leinonen
leinonen / tiny-raymarcher.frag
Created October 1, 2018 21:45
small raymarcher. nothing fancy
#ifdef GL_ES
precision mediump float;
#endif
uniform float time;
uniform vec2 resolution;
#define PI 3.1415926535898
#define EPS 0.01
const float clipFar = 16.0;