shw1 - not have during the quiz. - let x = 2 ;; val x : int...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Suggested Homework #1 (for Quiz #1 on 10/11/07) Suppose that the following list of bindings was entered into the Ocaml interpreter. For each binding, the interpreter responds with either: (a) the name of the variable, its value, and its type, as shown for the first binding in italics , or (b) a type error. Fill in the blanks (" ... ") with how the interpreter would respond if each of the bindings was entered in the sequence shown below. Recall that if a type error occurs, then the variable binding does not happen. Note that you could just enter this sequence into the interpreter and see what happens, but this is a luxury you will
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: not have during the quiz. - let x = 2 ;; val x : int = 2 - let x = 2 + 3 - 4.0 ;; ...- let x = 2 + 3 ;; ...- let x = "a" ;; ...- let x = (x,3) ;; ...- let y = ((snd x)^"b" , 2) ;; ...- let y = ((fst x)^"c" , 4) ;; ...- let z = if (x = y) then (snd x) else (snd y) ;; ...- type myrecord = {f1 : int; f2 : string ; f3 : int} ;;- let a = {f1 = x; f2 = (fst y); f3 = z} ;; ...- let b = z::(snd y):: ;; ...- let c = (x;y;z) ;; ...- let c = (x,y,z) ;; ...- let m = if (snd x) = (snd y) then b else ;; ...- let n = if (1 > 2) then ["a";"b"] else ;; ...- let o = if (m = n) then 2 else 3 ;; ......
View Full Document

This note was uploaded on 03/16/2010 for the course CSE 101 taught by Professor Staff during the Winter '08 term at UCSD.

Page1 / 2

shw1 - not have during the quiz. - let x = 2 ;; val x : int...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online