| # This is a very useful piece of software |
| |
|
| |
FUN oopify(prefix) -> prefix + "oop" # oopify function |
| |
|
| |
FUN join(elements, separator) # join function |
| |
VAR result = "" |
| |
VAR len = LEN(elements) |
| |
|
| |
FOR i = 0 TO len THEN |
| |
VAR result = result + elements/i # result variable |
| |
IF i != len - 1 THEN VAR result = result + separator |
| |
END # end |
| |
|
| |
RETURN result |
| |
END # end |
| |
|
| |
FUN map(elements, func) # map function |
| |
VAR new_elements = [] |
| |
|
| |
FOR i = 0 TO LEN(elements) THEN |
| |
APPEND(new_elements, func(elements/i)) |
| |
END # end |
| |
|
| |
RETURN new_elements # return to new_elements |
| |
END # end |
| |
|
| |
PRINT("Greetings universe!") # print to Greetings universe! |
| |
|
| |
FOR i = 0 TO 5 THEN |
| |
PRINT(join(map(["l", "sp"], oopify), ", ")) |
| |
END # end |