This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#lang r5rs | |
; Composable syntax-rules macros via the CK abstract machine | |
; | |
; We demonstrate (mutually-) recursive, higher-order applicative | |
; macros with clausal definitions, defined in the style that looks very | |
; much like that of ML or (strict) Haskell. | |
; We write composable, call-by-value--like macros without | |
; resorting to the continuation-passing-style and thus requiring no | |
; macro-level lambda. The syntax remains direct-style, with | |
; nested applications. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; Hask-- I mean, psilo with no real typeclasses and one virtual typeclass. | |
; Inspired by [1], this is an exploration of representing all typeclasses | |
; through one distinguished class. | |
; | |
; This version of psilo does not have "real" typeclasses. However faking them | |
; with explicit dictionary passing does seem to correctly infer and check the | |
; constraints. | |
; | |
; The goal then is to figure out how best to represent "real" typeclasses as a | |
; distinguished feature in the language implementation given that we are |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE RankNTypes #-} | |
import Prelude hiding (IO, getLine) | |
import qualified Prelude as P | |
import System.IO.Unsafe | |
-- * The Foreign Function Interface | |
-- | FFI values permit interfacing with foreign functions, such as low-level IO | |
-- operations, memory management operations, or bindings to other user-level |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh -exu | |
dev=$1 | |
cd $(mktemp -d) | |
function umountboot { | |
umount boot || true | |
umount root || true | |
} | |
# RPi1/Zero (armv6h): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-| | |
- Example of using free constructions to build a flexible little compiler. | |
- | |
- The goal here is not necessarily efficiency but readability and flexibility. | |
- | |
- The language grammar is represented by an ADT; however, instead of | |
- recursively referring to itself it instead references a type variable. | |
- | |
- We derive instances of 'Functor' and 'Traversable' for this type. | |
- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Large Type</title> | |
<link rel="stylesheet/less" type="text/css" href="style.less"> | |
<script type="text/javascript" src="lib/jquery-2.1.4.min.js"></script> | |
<script type="text/javascript" src="lib/less.min.js"></script> | |
</head> | |
<body> | |
<div class="out"><span contenteditable autofocus>*hello*</span></div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE DeriveFunctor #-} | |
import Control.Applicative | |
import Control.Comonad | |
import Control.Monad (forM_) | |
-- These two typeclasses probably make some people groan. | |
class LeftRight t where | |
left :: t a -> t a |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### | |
# Markov models! | |
# | |
# A Markov model of some process is a model of different states you can be in, | |
# where each state links to other states. These links are weighted by some | |
# probability score. Markov models are designed to model systems where future | |
# states depend only on the present state. | |
# | |
# In the case of words you may define "present state" to be "the current word," | |
# or perhaps "the last 3 words." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
### | |
# Script to launch jackd and reroute PulseAudio through it. And optionally | |
# start fluidsynth. | |
# | |
# READ THE NOTES PLEASE | |
### | |
# Usage (assuming this script is named `audio`, is in your PATH, and is |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Code: (+ 5 5) | |
Free (AApp (Free (ASymbol "+")) [Free (ANumber 5),Free (ANumber 5)]) | |
--- | |
Code: (lambda (x) (* x x)) | |
Free (ALambda [Free (ASymbol "x")] (Free (AApp (Free (ASymbol "*")) [Free (ASymbol "x"),Free (ASymbol "x")]))) | |
--- | |
Code: ((\ (x) (* x x)) 5 (+ 10 2)) | |
Free (AApp (Free (ALambda [Free (ASymbol "x")] (Free (AApp (Free (ASymbol "*")) [Free (ASymbol "x"),Free (ASymbol "x")])))) [Free (ANumber 5),Free (AApp (Free (ASymbol "+")) [Free (ANumber 10),Free (ANumber 2)])]) | |
--- | |
Code: '(1 2 3) |