Skip to content

Instantly share code, notes, and snippets.

@metaxy
Created August 30, 2010 10:48
Show Gist options
  • Save metaxy/557287 to your computer and use it in GitHub Desktop.
Save metaxy/557287 to your computer and use it in GitHub Desktop.
Ein Stapel in Haskell
module Stapel (
Stapel,
empty,
isEmpty,
push,
top,
pop
) where
data Stapel a = E | S a (Stapel a) deriving(Eq,Show)
empty = E
isEmpty s = s==E
push x s = S x s
top E = error "empty"
top (S x rs) = x
pop E = error "empty"
pop (S x rs) = rs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment