Skip to content

Instantly share code, notes, and snippets.

chaitanyagupta /
Last active Oct 19, 2020
Reader Macros in Common Lisp

Reader Macros in Common Lisp

This post also appears on

Reader macros are perhaps not as famous as ordinary macros. While macros are a great way to create your own DSL, reader macros provide even greater flexibility by allowing you to create entirely new syntax on top of Lisp.

Paul Graham explains them very well in [On Lisp][] (Chapter 17, Read-Macros):

The three big moments in a Lisp expression's life are read-time, compile-time, and runtime. Functions are in control at runtime. Macros give us a chance to perform transformations on programs at compile-time. do their work at read-time.

View Remove all git tags
#Delete local tags.
git tag -l | xargs git tag -d
#Fetch remote tags.
git fetch
#Delete remote tags.
git tag -l | xargs -n 1 git push --delete origin
#Delete local tasg.
git tag -l | xargs git tag -d
pchiusano / type-inhabitants.markdown
Last active Jan 21, 2020
Reasoning about type inhabitants in Haskell
View type-inhabitants.markdown

This is material to go along with a 2014 Boston Haskell talk.

We are going to look at a series of type signatures in Haskell and explore how parametricity (or lack thereof) lets us constrain what a function is allowed to do.

Let's start with a decidedly non-generic function signature. What are the possible implementations of this function which typecheck?

wrangle :: Int -> Int
chrisdone /
Last active Aug 21, 2020
Statically Typed Lisp

Basic unit type:

λ> replTy "()"
() :: ()

Basic functions:

karpathy /
Last active Oct 31, 2020
Minimal character-level language model with a Vanilla Recurrent Neural Network, in Python/numpy
Minimal character-level Vanilla RNN model. Written by Andrej Karpathy (@karpathy)
BSD License
import numpy as np
# data I/O
data = open('input.txt', 'r').read() # should be simple plain text file
chars = list(set(data))
data_size, vocab_size = len(data), len(chars)
yurydelendik / !
Last active Oct 31, 2020
Using WebAssembly in LLVM
View !

NOTE: the content is out-of-date. All development is moved to the

Using WebAssembly in LLVM


# locations, e.g.
export WORKDIR=~/llvmwasm; mkdir -p $WORKDIR
AndrasKovacs / STLC.hs
Last active Aug 14, 2016
Lambda calculus on the type level with GHC 7.11.20151212.
View STLC.hs
TypeInType, UndecidableInstances, TypeOperators, GADTs, TypeFamilies #-}
import Data.Kind
import GHC.Prim
import Data.Proxy
data Fun a b
type a ~> b = Fun a b -> Type
infixr 0 ~>
Icelandjack /
Last active Sep 8, 2020
Type Classes and Constraints

Reddit discussion.

Disclaimer 1: Type classes are great but they are not the right tool for every job. Enjoy some balance and balance to your balance.

Disclaimer 2: I should tidy this up but probably won’t.

Disclaimer 3: Yeah called it, better to be realistic.

Type classes are a language of their own, this is an attempt to document features and give a name to them.

View Printf.hs
{-# LANGUAGE GADTs, TypeInType, DataKinds, TypeFamilies #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE TypeApplications #-}
import GHC.TypeLits
import GHC.Types
import Data.Singletons
import Data.Singletons.Prelude
data Format = Lit Symbol | Str | Shown Type
You can’t perform that action at this time.