28. • OCaml
– API
“ ”
Stack
28
module Stack : (sig
type α t
val empty : α t
val push : α -> α t -> α t
val pop : α t -> (α * α t) option
end) = struct
type α t = α list
let empty = []
let push x s = x :: s
⋮
end
29. • OCaml
– API
“ ”
Stack
29
module Stack : (sig
type α t
val empty : α t
val push : α -> α t -> α t
val pop : α t -> (α * α t) option
end) = struct
type α t = α list
let empty = []
let push x s = x :: s
⋮
end
Stack
30. 30
module Stack : (sig
type α t
val empty : α t
val push : α -> α t -> α t
val pop : α t -> (α * α t) option
end) = struct
type α t = α list
let empty = []
let push x s = x :: s
⋮
end
Stack
α Stack.t
• OCaml
– API
“ ”
Stack
37. • Rowan Davies. A temporal-logic approach to binding-time analysis. In Proc. of LICS’96, pages
184–195, 1996.
• Steve Ganz, Amr Sabry, and Walid Taha. Macros as multi-stage computations: type-safe,
generative, binding macros in MacroML. In Proc. of ICFP’01, pages 74–85, 2001.
• Oleg Kiselyov. The design and implementation of BER MetaOCaml. In Functional and Logic
Programming. FLOPS 2014. Lecture Notes in Computer Science, vol 8475, 2014.
• Andreas Rossberg, Claudio Russo, and Derek Dreyer. F-ing modules. Journal of Functional
Programming, 24(5), pp. 529–607, 2014.
• Walid Taha and Tim Sheard. Multi-stage programming with explicit annotations. Theoretical
Computer Science, 248 (1-2), pages 211–242, 2000.
37