Skip to content

Instantly share code, notes, and snippets.

View larrytheliquid's full-sized avatar

Larry Diehl larrytheliquid

View GitHub Profile
tex = ARGV[0]
modified_at = File.mtime tex
puts "Starting from: #{modified_at}"
loop do
if modified_at != (mtime = File.mtime tex)
modified_at = mtime
`pdflatex #{tex}`
puts "Recompiled for: #{modified_at}"
end
@larrytheliquid
larrytheliquid / Maths.agda
Created July 15, 2011 03:10
Rudimentary but working Agda -> Ruby compilation & use examples (see test file at bottom) http://github.com/larrytheliquid/agda-rb
module Maths where
data Nat : Set where
zero : Nat
suc : Nat → Nat
plus : Nat → Nat → Nat
plus zero n = n
plus (suc m) n = suc (plus m n)
@larrytheliquid
larrytheliquid / narrow-slides-mode.el
Created August 28, 2012 21:38
Not actually a mode, just a quick hack for a presentation.
(defvar slide-delimiter
"----------------------------------------------------------------------"
"Delimiter used for changing slides")
(defun narrow-to-slide ()
(interactive)
(search-forward slide-delimiter)
(next-line)
(let ((start (point)))
(search-forward slide-delimiter)
@larrytheliquid
larrytheliquid / init.el
Created September 4, 2012 18:12
replace super and subscripts with a font that renders in emacs 24 on osx
(set-fontset-font t '(#x2080 . #x00208e) "Monoco")
(set-fontset-font t '(#x002070 . #x00207e) "Monoco")
@larrytheliquid
larrytheliquid / gist:3886590
Created October 13, 2012 23:27
inductive-recursive universe for dependent types
module IRDTT where
open import Level
open import Data.Product public using ( Σ ; _,_ ; proj₁ ; proj₂ )
open import Data.Sum public using ( _⊎_ ; inj₁ ; inj₂ )
record ⊤ {a} : Set a where
constructor tt
data Type {a} : Set (suc a)
⟦_⟧ : ∀{a} → Type {a} → Set a
@larrytheliquid
larrytheliquid / gist:3889346
Created October 14, 2012 18:04
inductive-recursive universe for dependent types (no unicode)
module IRDTT where
open import Level
open import Data.Product using ( _,_ )
renaming ( Σ to Sigma ; proj₁ to proj1 ; proj₂ to proj2 )
open import Data.Sum
renaming ( _⊎_ to Sum ; inj₁ to inj1 ; inj₂ to inj2 )
record Unit {a} : Set a where
constructor tt
@larrytheliquid
larrytheliquid / gist:3890780
Created October 15, 2012 04:10
IR DT Types + Terms
open import Level
open import Data.Product public using ( Σ ; _,_ ; proj₁ ; proj₂ )
data ⊥ {a} : Set a where
! : ∀ {a b} {A : Set a} → ⊥ {b} → A
! ()
record ⊤ {a} : Set a where
constructor tt
@larrytheliquid
larrytheliquid / TrailEquality.agda
Created February 3, 2013 15:23
Trail equality
module TrailEquality where
open import Relation.Binary.PropositionalEquality
open import Relation.Binary.HeterogeneousEquality
data Maybe (A : Set) : Set where
just : (x : A) → Maybe A
nothing : Maybe A
data ℕ : Set where
zero : ℕ
open import Data.Bool
open import Data.Nat
open import Data.String
module CrazyNames where
data U : Set where
`Bool `ℕ : U
El : U → Set
El `Bool = Bool
airtheliquid:spire larrytheliquid$ ./spire
Enter type:
If (Not (Not True)) Bool Unit
Enter term:
Not True
Well typed!
=> False : Bool