Skip to content

Instantly share code, notes, and snippets.

View abhin4v's full-sized avatar

Abhinav Sarkar abhin4v

View GitHub Profile
#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 April 17, 2024 10:51
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.