-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Victor
committed
Jul 31, 2024
1 parent
8bf3447
commit d21a33e
Showing
10 changed files
with
175 additions
and
239 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,12 @@ | ||
include "maeel" | ||
|
||
fun inline fact ( | ||
dup 1= | ||
(drop 1) | ||
(dup 1- fact *) | ||
ifelse | ||
dup 1 = (drop 1) (dup 1- fact*) ifelse | ||
) | ||
|
||
fun map xs fn ( | ||
List | ||
xs (fn!) for | ||
end | ||
fun inline fib ( | ||
dup 1 < (drop 1) (dup 1- fib swap 2- fib+) ifelse | ||
) | ||
|
||
fun range a b ( | ||
List | ||
a (dup 1+) (dup b<) while | ||
end | ||
) | ||
|
||
|
||
1 10 range (fib) map putsln | ||
1 10 range (fact) map putsln |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1 @@ | ||
include "maeel" | ||
|
||
1 1+ 2= ? ("Yep!" putsln) | ||
|
||
2 20 pow 3 15 pow < | ||
("2^20 is lower than 3^15" putsln) | ||
("2^20 is greater than 3^15" putsln) | ||
ifelse | ||
# TODO |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,4 +20,4 @@ List 1 2 3 4 end (putsln) for | |
( | ||
n putsln | ||
n 2 *~ n | ||
) (n 65536 <) while | ||
) (n 65536 <) while |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1 @@ | ||
include "maeel" | ||
|
||
List 1 2 3 4 5 end ~ this_is_a_list | ||
|
||
this_is_a_list (1+) map ~ added_one | ||
added_one (2*) map ~ mul_by_two | ||
mul_by_two (+) 0 reduce ~ this_is_the_sum | ||
|
||
1 20 range ~ from_1_to_19 | ||
from_1_to_19 (2%0=) filter ~ only_evens | ||
|
||
|
||
"This is a list: " puts this_is_a_list putsln | ||
"Added one two every element: " puts added_one putsln | ||
"Multiplied every element by two: " puts mul_by_two putsln | ||
"This is the sum of the new list: " puts this_is_the_sum putsln | ||
"Here are the numbers from 1 to 19: " puts from_1_to_19 putsln | ||
"Here are the even numbers only: " puts only_evens putsln | ||
# TODO |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.