Begin match no with none len some n loop nnext

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: g 2012 1+( )! no v! next! 2! None! fun (no: …) ->! begin match no with! | None -> 0! | Some n -> 1 + (loop n.next)! end! n 36 Stack length Evalua@ng length q Workspace ( Heap fun (q:'a queue) ->! let rec loop (no:…) : int =! …! in! loop q.head ! )! head! 1 + 1! q tail! loop v! ( )! 1! next! no n v! next! 2! None! fun (no: …) ->! begin match no with! | None -> 0! | Some n -> 1 + (loop n.next)! end! CIS120 / Spring 2012 37 Stack length Evalua@ng length q Workspace ( Heap fun (q:'a queue) ->! let rec loop (no:…) : int =! …! in! loop q.head ! )! head! 2! q tail! loop v! ( )! 1! next! no n POP! CIS120 / Spring 2012 v! next! 2! None! fun (no: …) ->! begin match no with! | None -> 0! | Some n -> 1 + (loop n.next)! end! 38 Stack length Evalua@ng length q Workspace ( Heap fun (q:'a queue) ->! let rec loop (no:…) : int =! …! in! loop q.head ! )! head! 2! q tail! loop v! 1! next! v! next! POP! CIS120 / Spring 2012 2! None! fun (no: …) ->!...
View Full Document

Ask a homework question - tutors are online