Outputs:
s1 0.3 a
s2 2.1 1
zip 2.1 a
zip 2.1 1
s2 4.2 2
# HTML | |
attribute := /([^\\"']|\\.)*/ | |
name := /([a-zA-Z])+/ | |
dquoted := /"/ attribute /"/ | |
squoted := /'/ attribute /'/ | |
quotes := dquoted | squoted | |
ws := /[ \t]+/ | |
attrpair := name ws /=/ ws quotes | |
opentag := /</ name (ws attrpair)* />/ | |
closetag := /<\// name />/ |
/* | |
There aren't any text book -texts on folds, dunno why. Keywords: structural induction, catamorphisms, recursion schemems. | |
Not so formally, "fold" is function replacing constructors in the data structure: | |
*/ | |
Bool = True | False | |
// Constructor types: | |
// True: Bool | |
// False: Bool | |
boolFold[X](t: X, f: X): X |
// Playground - noun: a place where people can play | |
import Foundation | |
// We <3 Swift | |
class Box<T> { | |
let unbox: T | |
init(_ value: T) { self.unbox = value } | |
} |
import Prelude hiding (id, (.)) | |
import Control.Category | |
import Control.Arrow | |
import Control.Arrow.Transformer.Automaton | |
import Test.QuickCheck | |
import Test.QuickCheck.Function | |
type Auto = Automaton (->) | |
runAuto :: Auto b c -> b -> (c, Auto b c) |
{-# LANGUAGE OverloadedStrings #-} | |
import Control.Applicative | |
import Control.Monad | |
import Data.Aeson | |
import Data.ByteString.Lazy as B -- imported so it's easy to work in ghci | |
import qualified Data.HashMap.Strict as HashMap | |
type DirectoryName = String |
"use strict"; | |
var parser = require("mixfix").parser; | |
// Have to add this to mixfix! | |
function token(x) { | |
return parser.any.satisfy(function (y) { | |
return x === y; | |
}) | |
} |
module Denotational where | |
open import Data.Nat | |
open import Data.Sum | |
open import Data.Product | |
open import Data.List | |
open import Relation.Nullary | |
import Relation.Nullary.Decidable as Dec | |
open import Relation.Binary.PropositionalEquality as PropEq | |
using (_≡_; refl; cong; sym) |
bench: queue | |
version: 0.1.0.0 | |
license-file: LICENSE | |
author: foo | |
maintainer: foo@bar.com | |
build-type: Simple | |
cabal-version: >=1.10 | |
executable queue |
{-# LANGUAGE BangPatterns #-} | |
module Main where | |
import Control.Concurrent | |
import Control.DeepSeq | |
import System.Environment (getArgs) | |
import System.IO.Unsafe (unsafePerformIO) | |
data Tree a = Tree (Tree a) a (Tree a) | |
instance Functor Tree where |