20-CS-4003-001 Organization of Programming Languages Fall 2017
Operations

Lambda calculus, Type theory, Formal semantics, Program analysis

    Prev     Next     All lectures        Code

Miscellaneous Operations

 
(let* ((a1 (max 1 3 0 6 5 4))  -  a1 is 6
1111111(a2 (min 1 3 0 6 5 4))  -  a2 is 0
1111111(a3 (string-append "He" "llo"))  -  a3 is "Hello" (Strings are not lists of chars)
1111111(a4 (string-ref "Hello" 2)))  -  a4 is #\l
1111111(a5 (+ 2 3)))  -  a5 is 5 (expression syntax: (op arg arg ..))
1111111(a6 (/ (* 2 a5) a1)))  -  a6 is 5/3 (rational arithmetic)
1111111(a7 (+ 2 (* 4 3)))  -  a7 is 14 (nested arithmetic operations)
1111111(a8 (modulo 10 3))  -  a8 is 1 (modulo arithmetic)
1111111(a9 (floor (/ 10 3)))  -  a9 is 3
1111111(a10 (< 6 7))  -  a10 is #t (6 is less than 7)
111(list a1 a2 a3 a4 a5 a6 a7 a8 a9 a10))  -  list the results