Time for an 2014 update…
This commit is contained in:
parent
372c577f83
commit
09687c4926
2520 changed files with 34227 additions and 7318 deletions
|
|
@ -0,0 +1,8 @@
|
|||
!. map @++ [ 1 4 8 ]
|
||||
|
||||
#implemented roughly like this:
|
||||
#map f lst:
|
||||
# ]
|
||||
# for i in lst:
|
||||
# f i
|
||||
# [
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
#define system.
|
||||
|
||||
#symbol PrintSecondPower =
|
||||
&&:n [ console writeLine:(n * n) ].
|
||||
(:n) [ console writeLine:(n * n) ].
|
||||
|
||||
#symbol program =
|
||||
[
|
||||
|
|
|
|||
|
|
@ -7,6 +7,10 @@ a;
|
|||
# [ 1, 4, 9, 16 ]
|
||||
|
||||
# Apply and don't change values
|
||||
List(b, n -> n*n);
|
||||
# [ 1, 4, 9, 16 ]
|
||||
|
||||
# Apply and don't return anything (only side effects)
|
||||
Perform(b, Display);
|
||||
1
|
||||
2
|
||||
|
|
|
|||
|
|
@ -17,6 +17,6 @@ end
|
|||
|
||||
squares3 = [n * n for n in numbers] # no need for a function,
|
||||
|
||||
squares4 = numbers .* numbers #element-wise operation
|
||||
squares4 = numbers .* numbers # element-wise operation
|
||||
|
||||
squares4a = numbers .^ 2 #includes .+, .-, ./, comparison, and bitwise operations as well
|
||||
squares4a = numbers .^ 2 # most arithmetic operations can be done element-wise
|
||||
|
|
|
|||
|
|
@ -0,0 +1,3 @@
|
|||
declare x(5) initial (1,3,5,7,8);
|
||||
x = sqrt(x);
|
||||
x = sin(x);
|
||||
Loading…
Add table
Add a link
Reference in a new issue