Skip to content

Instantly share code, notes, and snippets.

View abhin4v's full-sized avatar

Abhinav Sarkar abhin4v

View GitHub Profile
@kritzcreek
kritzcreek / Main.purs
Last active July 30, 2024 03:05
How to compile with continuations - Matt Might http://matt.might.net/articles/cps-conversion/
module Main where
import Prelude
import Data.Generic.Rep (class Generic)
import Data.Generic.Rep.Show (genericShow)
import Effect (Effect)
import Effect.Console as Console
import Effect.Ref (Ref)
import Effect.Ref as Ref
#lang racket
;; factorial
(define (fact n)
(if (= n 1) 1 (* n (fact (- n 1)))))
;; what if we couldnt use define or letrec and still had to define factorial
;; I'm using define to "wrap" the contents and prevent it from leaking, but
;; the important part is I define fact-int and pass it to itself ...
@ragingwind
ragingwind / Backend Architectures Keywords and References.md
Last active July 4, 2024 13:00
Backend Architectures Keywords and References
@ckirkendall
ckirkendall / clojure-match.clj
Created June 15, 2012 02:26 — forked from bkyrlach/Expression.fs
Language Compare F#, Ocaml, Scala, Clojure, Ruby and Haskell - Simple AST example
(use '[clojure.core.match :only [match]])
(defn evaluate [env [sym x y]]
(match [sym]
['Number] x
['Add] (+ (evaluate env x) (evaluate env y))
['Multiply] (* (evaluate env x) (evaluate env y))
['Variable] (env x)))
(def environment {"a" 3, "b" 4, "c" 5})
@simonmichael
simonmichael / gist:1185421
Created September 1, 2011 03:59
ghc-pkg-clean, ghc-pkg-reset
# unregister broken GHC packages. Run this a few times to resolve dependency rot in installed packages.
# ghc-pkg-clean -f cabal/dev/packages*.conf also works.
function ghc-pkg-clean() {
for p in `ghc-pkg check $* 2>&1 | grep problems | awk '{print $6}' | sed -e 's/:$//'`
do
echo unregistering $p; ghc-pkg $* unregister $p
done
}
# remove all installed GHC/cabal packages, leaving ~/.cabal binaries and docs in place.