-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added a lot of features. Release-candidate 1.1
- Loading branch information
Showing
9 changed files
with
262 additions
and
63 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 was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// Project Euler problem one ! | ||
// Ported from http://blog.kjempekjekt.com/2011/12/18/forth/ ! | ||
|
||
# next-is-zero | ||
dup 0 = | ||
! | ||
|
||
# multiple-of-3 | ||
dup 3 % 0 = | ||
! | ||
|
||
# multiple-of-5 | ||
dup 5 % 0 = | ||
! | ||
|
||
# keep-number-if-multiple-of-3-or-5 | ||
multiple-of-3 ? | ||
dup | ||
: multiple-of-5 ? | ||
dup | ||
: ; ; | ||
1 - | ||
! | ||
|
||
# generate-numbers | ||
next-is-zero not ? | ||
keep-number-if-multiple-of-3-or-5 generate-numbers | ||
: . ; | ||
! | ||
|
||
# sum-numbers | ||
+ | ||
len 1 = not ? | ||
sum-numbers | ||
: ; | ||
! | ||
|
||
999 generate-numbers sum-numbers ! |
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 |
---|---|---|
@@ -0,0 +1,45 @@ | ||
// Project Euler problem three ! | ||
// The prime factors of 13195 are 5, 7, 13 and 29. ! | ||
// What is the largest prime factor of the number 600851475143 ? ! | ||
|
||
// The implementation below is brute-force based, and will not teminate within reasonable time, given 600851475143 as input. ! | ||
// Even calculating the prime factors of 13195 will take several minutes. ! | ||
// Although not practical, this example is left as another sample of STCK-code ! | ||
|
||
|
||
# divides-13195 | ||
dup 13195 swap % 0 = | ||
! | ||
|
||
# is-larger-than-13195 | ||
dup 13195 < | ||
! | ||
|
||
# is-even | ||
dup 2 % 0 = | ||
! | ||
|
||
# is-prime | ||
dup 2 = ? | ||
0 | ||
: dup dup is-prime-rec ; | ||
! | ||
|
||
# is-prime-rec | ||
1 - | ||
dup 1 = ? | ||
. . 1 | ||
: 2dup rem 0 = ? | ||
. . 0 | ||
: is-prime-rec ; ; | ||
! | ||
|
||
# gen-prime | ||
1 + | ||
is-larger-than-13195 not ? is-prime ? divides-13195 ? | ||
dup : ; : ; | ||
gen-prime | ||
: . ; | ||
! | ||
|
||
1 gen-prime max ! |
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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
STCK build and syntax definition for Sublime Text 3 | ||
=================================================== | ||
|
||
This folder contains STCK configuration for the Sublime Text 3 editor. | ||
|
||
Install the package by copying the /STCK folder into your sublime-packages folder. Select the menu option Preferences -> Browse Packages... if you're unshure where your sublime-packages folder is located. |
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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"cmd": ["stck.exe", "$file"], | ||
"osx": { | ||
"cmd": ["stck", "$file"] | ||
}, | ||
"file_regex": "^((.*)\\.(stck(i|x)?))\\(([0-9]*),([0-9]*)\\):.*$", | ||
"selector": "source.fsharp" | ||
} |
Oops, something went wrong.