COS 320 Class Notes

COS 320 Class Notes - - val d : bool = true; d is declared...

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

View Full Document Right Arrow Icon
COS 320 Class Notes Feb 3 rd Main Course Webpage: moodle.cs.princeton.edu/course/view.php?id=42 Programming in ML: - ML is a language developed in the 1970’s, designed as a “controlling theorem prover.” - To run in Windows, use EMACS. - To run ML: $ sml.bat - ML is interactive – commands are executed on-the-fly, not in a file. (Although you can prep a file and execute from the file if you wish.) To run files as programs: - use “01.sml” where “01.sml” is the filename, “-“ is the prompt, and “use” is the ML command NOTE: Using commands -- the “use” command is “string unit” (meaning it takes a string and returns a unit.) Conventions of the language: - val d = true; d is declared and implied to be a Boolean from the expression
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: - val d : bool = true; d is declared and specified to be a Boolean!- val a = 11;- val a = 12; a is declared as 11 and then redeclared as 12. In ML, the redeclaring is called hiding the old value the old a is still kept in memory, but inaccessible.- val x = ref 0; x is a reference (a pointer) to a block in memory which stores 0- x := 7; changes the value in memory from 0 to 7- !x; returns value pointed to by x; right now, is 7 value it = syntax for returning an answer where the input variable is not specified ? value it = use(___) A way to run a file as a program (?)...
View Full Document

This note was uploaded on 03/25/2010 for the course COS 320 taught by Professor Greene during the Spring '06 term at Rutgers.

Ask a homework question - tutors are online