forked from XAMPPRocky/tokei
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Language Support for ATS (XAMPPRocky#840)
* Adding spec and test for ATS * Update language support list * Corrects language spec and test assertions Details: - Specifies quotation format - Correct key for specifying line comment - Correct expected test assertions (passed) * Fix inconsistent JSON formatting in languages.json * Update extension list Details: - To make it comply with github's linguist def
- Loading branch information
Showing
3 changed files
with
55 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -314,6 +314,7 @@ Asp | |
AspNet | ||
Assembly | ||
AssemblyGAS | ||
ATS | ||
Autoconf | ||
AutoHotKey | ||
Automake | ||
|
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,42 @@ | ||
//! 42 lines 25 code 9 comments 8 blanks | ||
|
||
(************* | ||
Reference: | ||
https://github.com/ats-lang/ats-lang.github.io/blob/master/DOCUMENT/ATS2TUTORIAL/CODE/chap_stream_vt.dats | ||
**************) | ||
#include "share/atspre_staload.hats" | ||
|
||
/* Lazy-evaluated integer iterator */ | ||
fun from | ||
(n: int): stream_vt(int) = | ||
$ldelay(stream_vt_cons(n, from(n + 1))) | ||
|
||
// Lazy-evaluated prime finder | ||
fun sieve | ||
(ns: stream_vt(int)) | ||
: stream_vt(int) = $ldelay( | ||
let | ||
val ns_con = !ns | ||
val- @stream_vt_cons(n0, ns1) = ns_con | ||
val n0_val = n0 | ||
val ns1_val = ns1 | ||
|
||
val () = | ||
(ns1 := sieve(stream_vt_filter_cloptr<int>(ns1_val, lam x => x mod n0_val > 0))) | ||
|
||
prval () = fold@(ns_con) | ||
in | ||
ns_con | ||
end | ||
, | ||
~ns | ||
) | ||
|
||
// Test run for finding the 1000-th prime number | ||
val thePrimes = sieve(from(2)) | ||
val p1000 = (steam_vt_drop_exn(thePrimes, 1000)).head() | ||
val () = println!("p1000 = ", p1000) | ||
|
||
implement main0 () = {} | ||
|
||
(* End of file *) |