annotate paper/src/AgdaStack.agda @ 116:ed6719c301fc

Update slide
author atton <atton@cr.ie.u-ryukyu.ac.jp>
date Mon, 13 Feb 2017 17:31:45 +0900
parents c0693ad89f04
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
65
c0693ad89f04 Add single linked stack
atton <atton@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1 data Element (a : Set) : Set where
c0693ad89f04 Add single linked stack
atton <atton@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2 cons : a -> Maybe (Element a) -> Element a
c0693ad89f04 Add single linked stack
atton <atton@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
3
c0693ad89f04 Add single linked stack
atton <atton@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
4 datum : {a : Set} -> Element a -> a
c0693ad89f04 Add single linked stack
atton <atton@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
5 datum (cons a _) = a
c0693ad89f04 Add single linked stack
atton <atton@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
6
c0693ad89f04 Add single linked stack
atton <atton@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
7 next : {a : Set} -> Element a -> Maybe (Element a)
c0693ad89f04 Add single linked stack
atton <atton@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
8 next (cons _ n) = n
c0693ad89f04 Add single linked stack
atton <atton@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
9
c0693ad89f04 Add single linked stack
atton <atton@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
10 record SingleLinkedStack (a : Set) : Set where
c0693ad89f04 Add single linked stack
atton <atton@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
11 field
c0693ad89f04 Add single linked stack
atton <atton@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
12 top : Maybe (Element a)
c0693ad89f04 Add single linked stack
atton <atton@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
13