Skip to content

Instantly share code, notes, and snippets.

Avatar

Karl-Oskar Rikås funrep

View GitHub Profile
@jozefg
jozefg / closconv.lhs
Last active Apr 18, 2020
Tutorial on Closure Conversion and Lambda Lifting
View closconv.lhs
This is my short-ish tutorial on how to implement closures in
a simple functional language: Foo.
First, some boilerplate.
> {-# LANGUAGE DeriveFunctor, TypeFamilies #-}
> import Control.Applicative
> import Control.Monad.Gen
> import Control.Monad.Writer
> import Data.Functor.Foldable
@HeinrichApfelmus
HeinrichApfelmus / GameLoop.hs
Created Oct 2, 2012
Game loop in reactive-banana
View GameLoop.hs
{------------------------------------------------------------------------------
reactive-banana
Implementation of an "industry strength" game loop with fixed time step
and variable fps.
See also http://gafferongames.com/game-physics/fix-your-timestep/
-------------------------------------------------------------------------------}
{-# LANGUAGE NoMonomorphismRestriction #-}
module Main where
@BonsaiDen
BonsaiDen / tokenize.js
Created Feb 12, 2012
Small, simple, JS tokenizer in JS.
View tokenize.js
/**
* Simple JavaScript tokenizer (not a full parser!!!)
*
* Portions taken from Narcissus by Brendan Eich <brendan@mozilla.org>.
*/
/*jshint evil: true, regexdash: false, regexp: false */
var KEYWORDS = [
'break',
You can’t perform that action at this time.