Warning: This guide contains system-level modifications. Some steps are irreversible or can render your system unbootable. Read every section fully before executing any command. Know what you are doing, or do not proceed.
| # | Section |
|---|
| {-# LANGUAGE DeriveFunctor #-} | |
| {-# LANGUAGE LambdaCase #-} | |
| import Control.Applicative (liftA2) | |
| import Data.Char | |
| import Data.Foldable (for_) | |
| import Data.Functor | |
| import qualified Data.HashMap.Strict as M | |
| import Data.List (intercalate) | |
| import Prelude hiding (any) |
| // | |
| // Author: Jonathan Blow | |
| // Version: 1 | |
| // Date: 31 August, 2018 | |
| // | |
| // This code is released under the MIT license, which you can find at | |
| // | |
| // https://opensource.org/licenses/MIT | |
| // | |
| // |
| ;; vim: set sts=2 sw=2 et sm lisp : | |
| (defvar *reading-a-list* nil) | |
| (defun read-terminator (stream char) | |
| (declare (ignore stream)) | |
| (error (format nil "unexpected ~S" char))) | |
| (defun get-infix-precedence (symbol) | |
| (case symbol |
Summary of and excerpts from chapter 9 and 10 of On Lisp. Examples are mainly in Common Lisp.
| #!/usr/bin/env python3 | |
| import asyncio | |
| import multiprocessing | |
| import os | |
| import ssl | |
| from time import sleep | |
| port = 9000 |
| signature TYPEINFER = | |
| sig | |
| type tvar = int | |
| datatype monotype = TBool | |
| | TArr of monotype * monotype | |
| | TVar of tvar | |
| datatype polytype = PolyType of int list * monotype | |
| datatype exp = True | |
| | False | |
| | Var of int |
| //xcr.c | |
| //cc -o xcr $(pkg-config --cflags --libs cairo xcb xcb-icccm) xcr.c -lcairo -lxcb -lxcb-icccm | |
| #include <stdlib.h> | |
| #include <string.h> | |
| #include <cairo.h> | |
| #include <cairo-xcb.h> | |
| #include <xcb/xcb.h> | |
| #include <xcb/xcb_image.h> | |
| #include <xcb/xcb_aux.h> | |
| #include <xcb/xcb_icccm.h> |
| 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 |
| # gcc -Wall -o match match.c && ./match | |
| # | |
| #include <stdio.h> | |
| #include <string.h> | |
| #include <regex.h> | |