lec1 - to evaluate an addition evaluate the subexpressions...

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

View Full Document Right Arrow Icon
(* CSE 341, Spring 2008 *) (* Lecture 1, our first ML program *) (* val is a keyword x is a variable name = is used as a keyword here (has different meaning in expressions) 34 is a very simple expression (and value) ; is used as a keyword here (has different meaning in expressions) *) val x = 34; (* environment: x-->34 *) val y = 17; (* environment: y-->17, x-->34 *)
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: (* to evaluate an addition, evaluate the subexpressions and add *) (* to evaluate a variable, lookup its value in the environment *) val z = (x + y) + (y + 2); (* environment: z-->70, y-->17, x-->34 *) val q = z+1; val abs_of_z = if z < 0 then 0 - z else z; val abs_of_z_simpler = abs z...
View Full Document

This note was uploaded on 10/12/2009 for the course CSE 341 taught by Professor Staff during the Spring '08 term at University of Washington.

Ask a homework question - tutors are online