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
var people = { | |
"heights": [2, 6, 10, 14, 18, 22, 26, 30], | |
"probabilities": [1, 2, 3, 4, 4, 3, 2, 1] | |
}; | |
// generate a state of the form [john's height, bill's height] | |
var statePrior = function() { | |
return [categorical(people.probabilities, people.heights),categorical(people.probabilities, people.heights)]; | |
}; |
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 GADTs, FlexibleInstances #-} | |
module Paychecks where | |
type E = String | |
data Z | |
data S n | |
data Arity k where |
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
import Data.Vect | |
op : Nat -> Type -> Type | |
op Z a = a | |
op (S n) a = a -> op n a | |
mutual | |
data RoseTree : a -> Type where | |
Rose : (n : Nat ** OpTree n a) -> RoseTree 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
{-# LANGUAGE TypeFamilies, FlexibleInstances, FlexibleContexts #-} | |
{-# LANGUAGE NoMonomorphismRestriction #-} | |
module RecVP where | |
type Ent = Int | |
-- Dummy zero-ary type for individuals | |
data Stack a = Stack [a] | |
-- "Stack" is a dummy monadic constructor that wraps around any list of things |
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
module FocusMonad where | |
data Focused e a = | |
Normal a | |
| FMarked e (Focused e (e -> a)) | |
run :: Focused e a -> a | |
run (Normal a) = a | |
run (FMarked e f) = run f e |
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 FlexibleInstances #-} | |
{-# LANGUAGE FunctionalDependencies #-} | |
module App where | |
class Apply f g ret | f g -> ret where | |
app :: f -> g -> ret | |
instance Applicative f => Apply (f (a -> b)) (f a) (f b) where | |
fs `app` xs = fs <*> xs |
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
module NonDep where | |
import Control.Monad.Random | |
import System.IO.Unsafe | |
import Data.List (nub) | |
type Env = Int | |
data NonDep a = ND {unND :: Rand StdGen (Env -> a)} | |
instance Monad NonDep where |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
<html> | |
<head> | |
<title>Lambda Calculator - Exercise File Format</title> | |
<meta charset="UTF-8" /> | |
<style> | |
pre { | |
border: 1px solid #CCCCCC; | |
background-color: #EEEEEE; | |
padding: .5em; | |
} |
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
<html> | |
<head> | |
<title>Lambda Calculator - Entering Special Symbols</title> | |
<meta charset="UTF-8" /> | |
<style> | |
pre { | |
border: 1px solid #CCCCCC; | |
background-color: #EEEEEE; | |
padding: .5em; | |
} |