Skip to content

Commit

Permalink
New module
Browse files Browse the repository at this point in the history
  • Loading branch information
perezzini committed Sep 27, 2017
1 parent b2846f7 commit 0530652
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
11 changes: 11 additions & 0 deletions tigerpila.sig
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
signature tigerpila =
sig

type 'a Pila
val nuevaPila : unit -> 'a Pila
val nuevaPila1 : 'a -> 'a Pila
val pushPila : 'a Pila -> 'a -> unit
val popPila : 'a Pila -> unit
val topPila : 'a Pila -> 'a

end
13 changes: 13 additions & 0 deletions tigerpila.sml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
structure tigerpila :> tigerpila =
struct

type 'a Pila = 'a list ref
fun nuevaPila() = ref []
fun nuevaPila1 e = ref [e]
fun pushPila pila item = pila:=(item::(!pila))
fun popPila pila =
let val ret = hd(!pila)
in pila:=tl(!pila) end
fun topPila pila = hd(!pila)

end

0 comments on commit 0530652

Please sign in to comment.