Add tasks for all the new languages

This commit is contained in:
Tina Müller 2016-12-05 23:44:36 +01:00
parent 9dc3c2bb62
commit bba7bfd280
13208 changed files with 134745 additions and 0 deletions

View file

@ -0,0 +1,5 @@
Integer[] myInts = new Integer[]{1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
for (Integer i : myInts) {
System.debug(i);
}

View file

@ -0,0 +1,4 @@
FOR INDEX$=("The","quick","brown","fox","jumps","over","the","lazy","dog.") DO
PRINT(INDEX$;" ";)
END FOR
PRINT

View file

@ -0,0 +1,13 @@
(define my-list '( albert simon antoinette))
(for ((h my-list)) (write h))
albert simon antoinette
(define my-vector #(55 66 soixante-dix-sept))
(for (( u my-vector)) (write u))
55 66 soixante-dix-sept
(define my-string "Longtemps")
(for ((une-lettre my-string)) (write une-lettre))
"L" "o" "n" "g" "t" "e" "m" "p" "s"
;; etc ... for other collections like Streams, Hashes, Graphs, ...

View file

@ -0,0 +1,18 @@
' FB 1.05.0
' FreeBASIC doesn't have a foreach loop but it's easy to manufacture one using macros
#Macro ForEach(I, A)
For _i as integer = LBound(A) To UBound(A)
#Define I (A(_i))
#EndMacro
#Define In ,
Dim a(-5 To 5) As Integer = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}
ForEach(i in a)
Print i; " ";
Next
Print
Sleep

View file

@ -0,0 +1,4 @@
(lists:foreach
(lambda (x)
(io:format "item: ~p~n" (list x)))
(lists:seq 1 10))

View file

@ -0,0 +1 @@
array(1,2,3) => foreach { stdoutnl(#1) }

View file

@ -0,0 +1 @@
with i in array(1,2,3) do { stdoutnl(#i) }

View file

@ -0,0 +1,4 @@
days = ["monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday"]
repeat with day in days
put day
end repeat

View file

@ -0,0 +1,13 @@
----------------------------------------
-- One of the five native iterative methods defined in ECMAScript 5
-- @param {list} tList
-- @param {symbol} cbFunc
-- @param {object} [cbObj=_movie]
----------------------------------------
on forEach (tList, cbFunc, cbObj)
if voidP(cbObj) then cbObj = _movie
cnt = tList.count
repeat with i = 1 to cnt
call(cbFunc, cbObj, tList[i], i, tList)
end repeat
end

View file

@ -0,0 +1,2 @@
days = ["monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday"]
forEach(days, #alert, _player)

View file

@ -0,0 +1,4 @@
repeat for each item x in "red, green, blue"
put x & cr
--wait 100 millisec -- req'd if you want to see in the LC Message Box (akin to repl)
end repeat

View file

@ -0,0 +1,6 @@
var list: seq[string] = @[]
list.add("lorem")
list.add("ipsum")
list.add("dolor")
for i in items(list):
echo(i)

View file

@ -0,0 +1 @@
: printMonths | m | Date.Months forEach: m [ m . ] ;

View file

@ -0,0 +1 @@
#. Date.Months apply

View file

@ -0,0 +1,5 @@
var numbers = 1..10;
numbers each # (number) [
printf("%i\n", number);
];

View file

@ -0,0 +1,4 @@
sequence s = {-2,"field",3.14159268979,{"this","that"}}
for i=1 to length(s) do
?s[i]
end for

View file

@ -0,0 +1,4 @@
aList = "Welcome to the Ring Programming Language"
for n in aList
see n + nl
next

View file

@ -0,0 +1,3 @@
foreach [1,2,3] { |i|
say i
}

View file

@ -0,0 +1,3 @@
for i in [1,2,3] {
say i
}

View file

@ -0,0 +1,3 @@
[1,2,3].each { |i|
say i
}

View file

@ -0,0 +1,4 @@
let hash = { "foo": 42, "bar": 1337, "baz": "qux" };
foreach(hash, function(key, val) {
print(key, " -> ", val);
});

View file

@ -0,0 +1,3 @@
for i in [1,2,3] {
print(i)
}

View file

@ -0,0 +1,3 @@
[1,2,3].forEach {
print($0)
}

View file

@ -0,0 +1,2 @@
each x '(1 2 3)
prn x

View file

@ -0,0 +1 @@
(FOR-EACH PRINT '(CYRUS CAMBYSES DARIUS XERXES ARTAXERXES))

View file

@ -0,0 +1 @@
def example: [1,2];

View file

@ -0,0 +1,2 @@
example | .[]
# or equivalently: example[]

View file

@ -0,0 +1,2 @@
{"a":1, "b":2} | .[]
# or equivalently: {"a":1, "b":2}[]

View file

@ -0,0 +1 @@
example | . as $a | range(0; length) | $a[.]

View file

@ -0,0 +1 @@
{"a":1, "b":2} | . as $o | keys | map( [., $o[.]] )

View file

@ -0,0 +1,3 @@
"abc" | . as $s | range(0;length) | $s[.:.+1]
"abc" | explode | map( [.]|implode) | .[]