Minor Notes from 14 Feb Lecture

Gotchas

1) the function to do exponentiation is pow(x,y)

2) the non-short-circuit boolean operators are:  and, or
(remember the short-circuit versions are andalso  orelse)

3) isAscii determines whether the char is in the classic 7-bit ascii range
(chars do the 8-bit extended ascii)

Something to think about


fun parseDigit x = ord(x) - 48;

fun rest s = substring(s, 1, size(s)-1);

We want to build a function that looks like:  

fun parseInt s  :   string -> int
(which takes multi-digit strings and returns the matching integer value)


I would suggest making the return value of this function be a helper function (call it "helper").

It should take three params:  the string
                              the size of the current string
                              how much you've computed so far.

IOW, fun parseInt s = helper s (size s) 0;

Think about how to define "helper".