Q tail loop v 1 next no v 2 next fun

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: nt =! …! in! loop q.head ! )! head! q tail! loop v! 1! next! v! 2! next! fun (no: …) ->! begin match no with! | None -> 0! | Some n -> 1 + (loop n.next)! end! CIS120 / Spring 2012 19 Evalua@ng length Workspace ( Stack length )! q ( Heap fun (q:'a queue) ->! let rec loop (no:…) : int =! …! in! loop q.head ! )! head! q tail! loop v! 1! next! Aier a few steps… (From here on, we’ll take some shortcuts in the ASM anima@ons.) CIS120 / Spring 2012 v! 2! next! fun (no: …) ->! begin match no with! | None -> 0! | Some n -> 1 + (loop n.next)! end! 20 Evalua@ng length Workspace Stack length begin match no with! | None -> 0! | Some n -> 1 + (loop n.next)! end! q ( Heap fun (q:'a queue) ->! let rec loop (no:…) : int =! …! in! loop q.head ! )! head! q tail! loop v! ( )! 1! next! no v! 2! next! fun (no: …) ->! begin match no with! | None -> 0! | Some n -> 1 + (loop n.next)! end! CIS...
View Full Document

Ask a homework question - tutors are online