- List.iter (fun x ->
print_
int x) [1;2;3;4];; or in
short way: List.iter
print_
int [1;2;3;4];; For arrays: Array.iter (fun x ->
print_
int x) [|1;2;3;4|];;...
-
evaluation order, but a
similar program in OCaml: let f x =
print_
int x; x ;;
print_
int (f 1 + f 2)
outputs 213 due to OCaml's right-to-left evaluation...
- g(7) // 13
twice :: (
Int ->
Int) -> (
Int ->
Int)
twice f = f . f
plusThree ::
Int ->
Int plusThree = (+3) main :: IO () main =
print (g 7) -- 13
where g...
-
error = (STRING s) VOID: (
print(( newline, " error: ", s, newline)); GOTO stop); PROC one to = (
INT n) LIST: (PROC f = (
INT m,n) LIST: (m>n | NIL | cons(m...
- (real,
int, compl, string);
Usage example for
union case of node: node n := "1234"; case n in (real r):
print(("real:", r)), (
int i):
print(("
int:", i))...
-
Notes print_
int $v0 = 1 $a0 =
integer to
print prints $a0 to
standard output base = 10
print_string $v0 = 4 $a0 =
address of
first character prints a character...
-
union (real,
int, string, void); node n := "abc"; case n in (real r):
print(("real:", r)), (
int i):
print(("
int:", i)), (string s):
print(("string:", s))...
- " };", " for (
int i = 0; i < 6; i++) //
Print opening code", " System.out.println(l[i]);", " for (
int i = 0; i < l.length; i++) //
Print string array"...
-
polymorphism (including type classes) have
longer function names such as
print_
int,
print_string, etc. This can be seen as
advantage (more descriptive) or a...
- AFTER}; void nop(
int const c) {} void
print(
int const c) { putchar(c); }
struct Branch { enum
State const next_state; void (*action)(
int); };
struct Branch...