function keyword is replaced by the -> symbol, and indentation is used instead of curly braces (except when defining an [[associative array]]), as in Python. Also, parentheses can usually be omitted. Thus, the CoffeeScript equivalent of the snippet above is
-ys and is also available in several programming languages as a binding module to the libyamlscript.so shared library:
+'''[https://yamlscript.org YAMLScript]''' is a new programming language that uses [https://yaml.org/ YAML] as its syntax. It is a complete, functional, general purpose language, but can also be easily embedded in YAML files to make them dynamic at load time. Most existing YAML files and all JSON files are already valid YAMLScript programs. YAMLScript has a compiler/interpreter CLI program called [https://github.com/yaml/yamlscript/releases ys] and is also available in several programming languages as a binding module to the [https://github.com/yaml/yamlscript/releases libyamlscript.so] shared library:
+* [https://clojars.org/org.yamlscript/clj-yamlscript Clojure]
+* [https://clojars.org/org.yamlscript/yamlscript Java]
+* [https://www.npmjs.com/package/@yaml/yamlscript NodeJS]
* [https://metacpan.org/pod/YAMLScript Perl]
* [https://pypi.org/project/yamlscript/ Python]
* [https://raku.land/zef:ingy/YAMLScript Raku]
@@ -16,21 +19,23 @@
Run this command to install the ys command line YAMLScript runner/loader/compiler program.
- curl -s https://yamlscript.org/install | PREFIX=$HOME BIN=1 bash
+ curl -sSL yamlscript.org/install | bash
-That will install $HOME/bin/ys. If $HOME/bin is not in your PATH, run:
+That will install $HOME/.local/bin/ys. If $HOME/.local/bin is not in your PATH, run:
- export PATH=$HOME/bin:$PATH
+ export PATH=$HOME/.local/bin:$PATH
Test the new installation:
- $ ys --help
- ys - The YAMLScript (YS) Command Line Tool
+
+ $ ys --help
+ ys - The YAMLScript (YS) Command Line Tool
- Usage: ys [options] [file]
+ Usage: ys [options] [file]
- Options:
- -r, --run Compile and evaluate a YAMLScript file (default)
- -l, --load Output the evaluated YAMLScript value
- -e, --eval YSEXPR Evaluate a YAMLScript expression
- ...
+ Options:
+ -r, --run Compile and evaluate a YAMLScript file (default)
+ -l, --load Output the evaluated YAMLScript value
+ -e, --eval YSEXPR Evaluate a YAMLScript expression
+ ...
+
See https://yamlscript.org for more information.
\ No newline at end of file
diff --git a/Lang/YAMLScript/Rot-13 b/Lang/YAMLScript/Rot-13
new file mode 120000
index 0000000000..e4ce94bf65
--- /dev/null
+++ b/Lang/YAMLScript/Rot-13
@@ -0,0 +1 @@
+../../Task/Rot-13/YAMLScript
\ No newline at end of file
diff --git a/Lang/Yabasic/Euler-method b/Lang/Yabasic/Euler-method
new file mode 120000
index 0000000000..0d4bb47acc
--- /dev/null
+++ b/Lang/Yabasic/Euler-method
@@ -0,0 +1 @@
+../../Task/Euler-method/Yabasic
\ No newline at end of file
diff --git a/Lang/Yabasic/Hash-from-two-arrays b/Lang/Yabasic/Hash-from-two-arrays
new file mode 120000
index 0000000000..5956a47e87
--- /dev/null
+++ b/Lang/Yabasic/Hash-from-two-arrays
@@ -0,0 +1 @@
+../../Task/Hash-from-two-arrays/Yabasic
\ No newline at end of file
diff --git a/Lang/Yabasic/Semordnilap b/Lang/Yabasic/Semordnilap
new file mode 120000
index 0000000000..b07f006e9c
--- /dev/null
+++ b/Lang/Yabasic/Semordnilap
@@ -0,0 +1 @@
+../../Task/Semordnilap/Yabasic
\ No newline at end of file
diff --git a/Lang/Yabasic/Set-consolidation b/Lang/Yabasic/Set-consolidation
new file mode 120000
index 0000000000..d4735a97c5
--- /dev/null
+++ b/Lang/Yabasic/Set-consolidation
@@ -0,0 +1 @@
+../../Task/Set-consolidation/Yabasic
\ No newline at end of file
diff --git a/Lang/Yabasic/Window-creation-X11 b/Lang/Yabasic/Window-creation-X11
new file mode 120000
index 0000000000..4d53abb936
--- /dev/null
+++ b/Lang/Yabasic/Window-creation-X11
@@ -0,0 +1 @@
+../../Task/Window-creation-X11/Yabasic
\ No newline at end of file
diff --git a/Lang/Zig/Caesar-cipher b/Lang/Zig/Caesar-cipher
new file mode 120000
index 0000000000..c0eaca0400
--- /dev/null
+++ b/Lang/Zig/Caesar-cipher
@@ -0,0 +1 @@
+../../Task/Caesar-cipher/Zig
\ No newline at end of file
diff --git a/Lang/Zig/Loops-Wrong-ranges b/Lang/Zig/Loops-Wrong-ranges
new file mode 120000
index 0000000000..25a3b4b4d8
--- /dev/null
+++ b/Lang/Zig/Loops-Wrong-ranges
@@ -0,0 +1 @@
+../../Task/Loops-Wrong-ranges/Zig
\ No newline at end of file
diff --git a/Task/100-doors/ALGOL-68/100-doors-1.alg b/Task/100-doors/ALGOL-68/100-doors-1.alg
deleted file mode 100644
index 8b4fc67b17..0000000000
--- a/Task/100-doors/ALGOL-68/100-doors-1.alg
+++ /dev/null
@@ -1,20 +0,0 @@
-PROC doors = (INT limit)VOID:
-(
- MODE DOORSTATE = BOOL;
- BOOL closed = FALSE;
- BOOL open = NOT closed;
- MODE DOORLIST = [limit]DOORSTATE;
-
- DOORLIST the doors;
- FOR i FROM LWB the doors TO UPB the doors DO the doors[i]:=closed OD;
-
- FOR i FROM LWB the doors TO UPB the doors DO
- FOR j FROM LWB the doors BY i TO UPB the doors DO
- the doors[j] := NOT the doors[j]
- OD
- OD;
- FOR i FROM LWB the doors TO UPB the doors DO
- print((whole(i,-12)," is ",(the doors[i]|"opened"|"closed"),newline))
- OD
-);
-doors(100)
diff --git a/Task/100-doors/ALGOL-68/100-doors-2.alg b/Task/100-doors/ALGOL-68/100-doors-2.alg
deleted file mode 100644
index 70f031cd84..0000000000
--- a/Task/100-doors/ALGOL-68/100-doors-2.alg
+++ /dev/null
@@ -1,7 +0,0 @@
-PROC doors optimised = ( INT limit )VOID:
- FOR i TO limit DO
- REAL num := sqrt(i);
- printf(($g" is "gl$,i,(ENTIER num = num |"opened"|"closed") ))
- OD
-;
-doors optimised(limit)
diff --git a/Task/100-doors/Haxe/100-doors-1.haxe b/Task/100-doors/Haxe/100-doors-1.haxe
new file mode 100644
index 0000000000..f4cab3c8b8
--- /dev/null
+++ b/Task/100-doors/Haxe/100-doors-1.haxe
@@ -0,0 +1,23 @@
+class Main
+{
+ static public function main()
+ {
+ findOpenDoors( 100 );
+ }
+
+ static function findOpenDoors( n : Int )
+ {
+ var door = [];
+ for( i in 0...n + 1 ){ door[ i ] = false; }
+ for( i in 1...n + 1 ){
+ var j = i;
+ while( j <= n ){
+ door[ j ] = ! door[ j ];
+ j += i;
+ }
+ }
+ for( i in 1...n + 1 ){
+ if( door[ i ] ){ Sys.print( ' $i' ); }
+ }
+ }
+}
diff --git a/Task/100-doors/Haxe/100-doors.haxe b/Task/100-doors/Haxe/100-doors-2.haxe
similarity index 87%
rename from Task/100-doors/Haxe/100-doors.haxe
rename to Task/100-doors/Haxe/100-doors-2.haxe
index 4d86d44909..30853b01fb 100644
--- a/Task/100-doors/Haxe/100-doors.haxe
+++ b/Task/100-doors/Haxe/100-doors-2.haxe
@@ -11,7 +11,7 @@ class RosettaDemo
while((i*i) <= n)
{
- Sys.print(i*i + "\n");
+ Sys.println(i*i);
i++;
}
}
diff --git a/Task/100-doors/Langur/100-doors-1.langur b/Task/100-doors/Langur/100-doors-1.langur
index 2ec8f19359..48e130366a 100644
--- a/Task/100-doors/Langur/100-doors-1.langur
+++ b/Task/100-doors/Langur/100-doors-1.langur
@@ -1,4 +1,4 @@
-var .doors = [false] x 100
+var .doors = [false] * 100
for .i of .doors {
for .j = .i; .j <= len(.doors); .j += .i {
diff --git a/Task/100-doors/Langur/100-doors-2.langur b/Task/100-doors/Langur/100-doors-2.langur
index d2e0482cab..f120dd60c3 100644
--- a/Task/100-doors/Langur/100-doors-2.langur
+++ b/Task/100-doors/Langur/100-doors-2.langur
@@ -1 +1 @@
-writeln foldfrom(f if(.b: .a~[.c]; .a), [], .doors, series 1..len .doors)
+writeln foldfrom(fn(.a, .b, .c) if(.b: .a~[.c]; .a), [], .doors, series 1..len .doors)
diff --git a/Task/100-doors/Langur/100-doors-3.langur b/Task/100-doors/Langur/100-doors-3.langur
index 5481fef9ef..d1c575957b 100644
--- a/Task/100-doors/Langur/100-doors-3.langur
+++ b/Task/100-doors/Langur/100-doors-3.langur
@@ -1 +1 @@
-writeln map(f .x ^ 2, series 1..10)
+writeln map fn{^2}, 1..10
diff --git a/Task/100-doors/Langur/100-doors-4.langur b/Task/100-doors/Langur/100-doors-4.langur
deleted file mode 100644
index f73a204644..0000000000
--- a/Task/100-doors/Langur/100-doors-4.langur
+++ /dev/null
@@ -1 +0,0 @@
-writeln map f{^2}, 1..10
diff --git a/Task/100-doors/MSX-Basic/100-doors.basic b/Task/100-doors/MSX-Basic/100-doors-1.basic
similarity index 100%
rename from Task/100-doors/MSX-Basic/100-doors.basic
rename to Task/100-doors/MSX-Basic/100-doors-1.basic
diff --git a/Task/100-doors/Minimal-BASIC/100-doors-2.basic b/Task/100-doors/MSX-Basic/100-doors-2.basic
similarity index 100%
rename from Task/100-doors/Minimal-BASIC/100-doors-2.basic
rename to Task/100-doors/MSX-Basic/100-doors-2.basic
diff --git a/Task/100-doors/Minimal-BASIC/100-doors-3.basic b/Task/100-doors/MSX-Basic/100-doors-3.basic
similarity index 100%
rename from Task/100-doors/Minimal-BASIC/100-doors-3.basic
rename to Task/100-doors/MSX-Basic/100-doors-3.basic
diff --git a/Task/100-doors/Minimal-BASIC/100-doors-4.basic b/Task/100-doors/MSX-Basic/100-doors-4.basic
similarity index 100%
rename from Task/100-doors/Minimal-BASIC/100-doors-4.basic
rename to Task/100-doors/MSX-Basic/100-doors-4.basic
diff --git a/Task/100-doors/Minimal-BASIC/100-doors-1.basic b/Task/100-doors/Minimal-BASIC/100-doors.basic
similarity index 100%
rename from Task/100-doors/Minimal-BASIC/100-doors-1.basic
rename to Task/100-doors/Minimal-BASIC/100-doors.basic
diff --git a/Task/100-doors/Python/100-doors-6.py b/Task/100-doors/Python/100-doors-6.py
index 55126dde74..7524fc9970 100644
--- a/Task/100-doors/Python/100-doors-6.py
+++ b/Task/100-doors/Python/100-doors-6.py
@@ -1 +1 @@
-for i in range(1,101): print("Door %s is open" % i**2)
+for i in range(1,11): print("Door %s is open" % i**2)
diff --git a/Task/100-doors/Quite-BASIC/100-doors.basic b/Task/100-doors/Quite-BASIC/100-doors-1.basic
similarity index 100%
rename from Task/100-doors/Quite-BASIC/100-doors.basic
rename to Task/100-doors/Quite-BASIC/100-doors-1.basic
diff --git a/Task/100-doors/TUSCRIPT/100-doors-2.tu b/Task/100-doors/Quite-BASIC/100-doors-2.basic
similarity index 100%
rename from Task/100-doors/TUSCRIPT/100-doors-2.tu
rename to Task/100-doors/Quite-BASIC/100-doors-2.basic
diff --git a/Task/100-doors/TUSCRIPT/100-doors-1.tu b/Task/100-doors/TUSCRIPT/100-doors.tu
similarity index 100%
rename from Task/100-doors/TUSCRIPT/100-doors-1.tu
rename to Task/100-doors/TUSCRIPT/100-doors.tu
diff --git a/Task/100-doors/Tiny-Craft-Basic/100-doors.basic b/Task/100-doors/Tiny-Craft-Basic/100-doors.basic
deleted file mode 100644
index 2d31cb60f7..0000000000
--- a/Task/100-doors/Tiny-Craft-Basic/100-doors.basic
+++ /dev/null
@@ -1,9 +0,0 @@
-10 rem loop
-
- 20 let i = i + 1
- 30 print i * i, " open"
-
-40 if i * i < 100 then 10
-
-50 shell "pause"
-60 end
diff --git a/Task/100-prisoners/Dart/100-prisoners.dart b/Task/100-prisoners/Dart/100-prisoners.dart
new file mode 100644
index 0000000000..50b228d4d0
--- /dev/null
+++ b/Task/100-prisoners/Dart/100-prisoners.dart
@@ -0,0 +1,67 @@
+import 'dart:math';
+
+int playRandom(int n) {
+ var rnd = Random();
+ int pardoned = 0;
+ List+user words: riG rePEAT copies put mo rest types fup. 6 poweRin +full words: RIGHT REPEAT *error* PUT MOVE RESTORE *error* *error* *error* POWERINPUT +diff --git a/Task/Abbreviations-simple/REXX/abbreviations-simple.rexx b/Task/Abbreviations-simple/REXX/abbreviations-simple.rexx index 924e522ec2..2e7a28ab4e 100644 --- a/Task/Abbreviations-simple/REXX/abbreviations-simple.rexx +++ b/Task/Abbreviations-simple/REXX/abbreviations-simple.rexx @@ -1,29 +1,38 @@ /*REXX program validates a user "word" against a "command table" with abbreviations.*/ -parse arg uw /*obtain optional arguments from the CL*/ -if uw='' then uw= 'riG rePEAT copies put mo rest types fup. 6 poweRin' -say 'user words: ' uw +Parse Arg uw /*obtain optional arguments from the CL*/ +If uw='' Then uw= 'riG rePEAT copies put mo rest types fup. 6 poweRin' +Say 'user words: ' uw -@= 'add 1 alter 3 backup 2 bottom 1 Cappend 2 change 1 Schange Cinsert 2 Clast 3', +keyws= 'add 1 alter 3 backup 2 bottom 1 Cappend 2 change 1 Schange Cinsert 2 Clast 3', 'compress 4 copy 2 count 3 Coverlay 3 cursor 3 delete 3 Cdelete 2 down 1 duplicate', '3 xEdit 1 expand 3 extract 3 find 1 Nfind 2 Nfindup 6 NfUP 3 Cfind 2 findUP 3 fUP 2', 'forward 2 get help 1 hexType 4 input 1 powerInput 3 join 1 split 2 spltJOIN load', 'locate 1 Clocate 2 lowerCase 3 upperCase 3 Lprefix 2 macro merge 2 modify 3 move 2', - 'msg next 1 overlay 1 parse preserve 4 purge 3 put putD query 1 quit read recover 3', + 'msg next 1 overlay 1 Parse preserve 4 purge 3 put putD query 1 quit read recover 3', 'refresh renum 3 repeat 3 replace 1 Creplace 2 reset 3 restore 4 rgtLEFT right 2 left', '2 save set shift 2 si sort sos stack 3 status 4 top transfer 3 type 1 up 1' -say 'full words: ' validate(uw) /*display the result(s) to the terminal*/ -exit /*stick a fork in it, we're all done. */ -/*──────────────────────────────────────────────────────────────────────────────────────*/ -validate: procedure expose @; arg x; upper @ /*ARG capitalizes all the X words. */ - $= /*initialize the return string to null.*/ - do j=1 to words(x); _=word(x, j) /*obtain a word from the X list. */ - do k=1 to words(@); a=word(@, k) /*get a legitmate command name from @.*/ - L=word(@, k+1) /*··· and maybe get it's abbrev length.*/ - if datatype(L, 'W') then k=k + 1 /*yuppers, it's an abbrev length.*/ - else L=length(a) /*nope, it can't be abbreviated.*/ - if abbrev(a, _, L) then do; $=$ a; iterate j; end /*is valid abbrev?*/ - end /*k*/ - $=$ '*error*' /*processed the whole list, not valid. */ - end /*j*/ - return strip($) /*elide the superfluous leading blank. */ +Say 'full words: ' validate(uw) /*display the result(s) to the terminal*/ +Exit /*stick a fork in it, we're all done. */ +/*--------------------------------------------------------------------------------------*/ +validate: Procedure Expose keyws + keyws=translate(keyws) + Arg userwords /*ARG capitalizes all the userwords. */ + res='' /*initialize the Return string to null.*/ + Do j=1 to words(userwords) /* loop over userwords */ + uword=word(userwords,j) /*obtain a word from the userword list.*/ + Do k=1 to words(keyws) /* loop over keywords */ + kw=word(keyws,k) /*get a legitmate command name from keyws.*/ + L=word(keyws,k+1) /*··· and maybe get its abbrev length.*/ + If datatype(L,'W') Then /* it's a number - an abbrev length. */ + k=k + 1 /* skip it for next kw */ + Else /* otherwise */ + L=length(kw) /* it can't be abbreviated. */ + If abbrev(kw,uword,L) Then Do /* is valid abbreviation */ + res=res kw /* add to result string */ + Iterate j /* proceed with next userword */ + End + End + res=res '*error*' /*processed the whole list, not valid */ + End + Return strip(res) /* elide superfluous leading blank. */ diff --git a/Task/Abelian-sandpile-model/11l/abelian-sandpile-model.11l b/Task/Abelian-sandpile-model/11l/abelian-sandpile-model.11l index 45089a270b..c4417c5669 100644 --- a/Task/Abelian-sandpile-model/11l/abelian-sandpile-model.11l +++ b/Task/Abelian-sandpile-model/11l/abelian-sandpile-model.11l @@ -37,7 +37,7 @@ grid[32][32] = 64 * 64 simulate(&grid) -V ppm = File(‘sand_pile.ppm’, ‘w’) +V ppm = File(‘sand_pile.ppm’, WRITE) ppm.write_bytes(("P6\n#. #.\n255\n".format(grid.len, grid.len)).encode()) V colors = [[Byte(0), 0, 0], [Byte(255), 0, 0], diff --git a/Task/Abelian-sandpile-model/ALGOL-68/abelian-sandpile-model.alg b/Task/Abelian-sandpile-model/ALGOL-68/abelian-sandpile-model.alg index c04c801c1a..78eae6a7eb 100644 --- a/Task/Abelian-sandpile-model/ALGOL-68/abelian-sandpile-model.alg +++ b/Task/Abelian-sandpile-model/ALGOL-68/abelian-sandpile-model.alg @@ -34,7 +34,7 @@ BEGIN # model Abelian sandpiles # OP MAX = ( [,]INT s )INT: BEGIN INT result := s[ 1 LWB s, 2 LWB s ]; - FOR i FROM 1 LWB s TO 2 UPB s DO + FOR i FROM 1 LWB s TO 1 UPB s DO FOR j FROM 2 LWB s TO 2 UPB s DO IF s[ i, j ] > result THEN result := s[ i, j ] FI OD diff --git a/Task/Abundant-odd-numbers/REXX/abundant-odd-numbers.rexx b/Task/Abundant-odd-numbers/REXX/abundant-odd-numbers.rexx index cc89a46e52..810b592beb 100644 --- a/Task/Abundant-odd-numbers/REXX/abundant-odd-numbers.rexx +++ b/Task/Abundant-odd-numbers/REXX/abundant-odd-numbers.rexx @@ -1,40 +1,51 @@ -/*REXX pgm displays abundant odd numbers: 1st 25, one─thousandth, first > 1 billion. */ +/*REXX pgm displays abundant odd numbers: 1st 25, one-thousandth, first > 1 billion. */ parse arg Nlow Nuno Novr . /*obtain optional arguments from the CL*/ -if Nlow=='' | Nlow=="," then Nlow= 25 /*Not specified? Then use the default.*/ -if Nuno=='' | Nuno=="," then Nuno= 1000 /* " " " " " " */ -if Novr=='' | Novr=="," then Novr= 1000000000 /* " " " " " " */ -numeric digits max(9, length(Novr) ) /*ensure enough decimal digits for // */ -@= 'odd abundant number' /*variable for annotating the output. */ -#= 0 /*count of odd abundant numbers so far.*/ - do j=3 by 2 until #>=Nlow; $= sigO(j) /*get the sigma for an odd integer. */ - if $<=j then iterate /*sigma ≤ J ? Then ignore it. */ - #= # + 1 /*bump the counter for abundant odd #'s*/ - say rt(th(#)) @ 'is:'rt(commas(j), 8) rt("sigma=") rt(commas($), 9) - end /*j*/ +if Nlow=='' | Nlow==',' then Nlow= 25 /*Not specified? Then use the default.*/ +if Nuno=='' | Nuno==',' then Nuno= 1000 /* ' ' ' ' ' ' */ +if Novr=='' | Novr==',' then Novr= 1000000000 /* ' ' ' ' ' ' */ +numeric digits max(9,length(Novr)) /*ensure enough decimal digits for // */ +a= 'odd abundant number' /*variable for annotating the output. */ +n= 0 /*count of odd abundant numbers so far.*/ +do j=3 by 2 until n>=Nlow; /*get the sigma for an odd integer. */ + d=sigO(j) + if d>j then Do /*sigma = J ? Then ignore it. */ + n= n + 1 /*bump the counter for abundant odd n's*/ + say rt(th(n)) a 'is:'rt(commas(j),8) rt('sigma=') rt(commas(d),9) + End + end /*j*/ say -#= 0 /*count of odd abundant numbers so far.*/ - do j=3 by 2; $= sigO(j) /*get the sigma for an odd integer. */ - if $<=j then iterate /*sigma ≤ J ? Then ignore it. */ - #= # + 1 /*bump the counter for abundant odd #'s*/ - if #