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 @@
( ( '* putc ) swap times cr ) 1 5 loop

View file

@ -0,0 +1,21 @@
for (Integer i = 0; i < 5; i++) {
String line = '';
for (Integer j = 0; j < i; j++) {
line += '*';
}
System.debug(line);
}
List<String> lines = new List<String> {
'*',
'**',
'***',
'****',
'*****'
};
for (String line : lines) {
System.debug(line);
}

View file

@ -0,0 +1,6 @@
ClrHome
For(I,1,5)
For(J,1,I)
Output(J,I,"*")
End
End

View file

@ -0,0 +1,9 @@
shared void run() {
for(i in 1..5) {
for(j in 1..i) {
process.write("*");
}
print("");
}
}

View file

@ -0,0 +1,50 @@
[ Loops
=====
A program for the EDSAC
Demonstrates nested loops
and printer output
Works with Initial Orders 2 ]
T56K [ set load point ]
GK [ set theta ]
O21@ [ figure shift ]
[ 1 ] T24@ [ a = 0 ]
A19@ [ a = i ]
[ 3 ] T20@ [ j = a; a = 0 ]
O22@ [ write character ]
A20@ [ a = j ]
S17@ [ a -= 1 ]
U20@ [ j = a ]
E3@ [ if a>=0 go to 3 ]
O23@ [ write line feed ]
T24@ [ a = 0 ]
A19@ [ a = i ]
A17@ [ a += 1 ]
U19@ [ i = a ]
S18@ [ a -= 5 ]
G1@ [ if a<0 go to 1 ]
ZF [ halt ]
[ 17 ] P0D [ const: 1 ]
[ 18 ] P2D [ const: 5 ]
[ 19 ] P0F [ var: i ]
[ 20 ] P0F [ var: j ]
[ 21 ] #F [ figure shift ]
[ 22 ] ZF [ '+' character ]
[ 23 ] &F [ line feed ]
[ 24 ] P0F [ used to clear a ]
EZPF [ begin execution ]

View file

@ -0,0 +1,6 @@
FOR I=1 TO 5 DO
FOR J=1 TO I DO
PRINT("*";)
END FOR
PRINT
END FOR

View file

@ -0,0 +1,4 @@
01.10 FOR I=1,4; DO 2.0
02.10 FOR J=1,I; TYPE "*"
02.20 TYPE !

View file

@ -0,0 +1,10 @@
' FB 1.05.0 Win64
For i As Integer = 1 To 5
For j As Integer = 1 To i
Print "*";
Next
Print
Next
Sleep

View file

@ -0,0 +1,7 @@
fun main(n: int): [n]int =
loop (a = replicate n 0) = for i < n do
(loop (s = 0) = for j < i+1 do
s + j
let a[i] = s
in a)
in a

View file

@ -0,0 +1,7 @@
for($i = 0; $i < 5; $i++) {
for($j = 0; $j <= $i; $j++) {
echo '*';
}
echo '\n';
}

View file

@ -0,0 +1,31 @@
.ORIG 0x3000
AND R1,R1,0
ADD R1,R1,1
AND R5,R5,0
ADD R5,R5,5
NOT R5,R5
LOOPI LD R0,STAR
AND R2,R2,0
ADD R3,R1,0
LOOPJ OUT
ADD R2,R2,1
NOT R4,R2
ADD R4,R3,R4
BRZP LOOPJ
LD R0,LF
OUT
ADD R1,R1,1
ADD R4,R1,R5
BRN LOOPI
HALT
STAR .FILL 0x2A
LF .FILL 0x0A
.END

View file

@ -0,0 +1,4 @@
loop(5) => {^
loop(loop_count) => {^ '*' ^}
'\r'
^}

View file

@ -0,0 +1,7 @@
repeat with i = 1 to 5
str = ""
repeat with j = 1 to i
put "*" after str
end repeat
put str
end repeat

View file

@ -0,0 +1,8 @@
put 0 into n
repeat for 5 times
add 1 to n
repeat for n times
put "*"
end repeat
put return
end repeat

View file

@ -0,0 +1,10 @@
import morfa.base;
for (i in 0..5)
{
for (j in 0..i+1)
{
print("*");
}
println("");
}

View file

@ -0,0 +1,4 @@
for i in 1..5:
for i in 1..i:
stdout.write("*")
echo("")

View file

@ -0,0 +1,5 @@
: loopFor(n)
| i j |
n loop: i [
i loop: j [ "*" print ]
printcr ;

View file

@ -0,0 +1,6 @@
for i=1 to 5 do
for j=1 to i do
puts(1,"*")
end for
puts(1,"\n")
end for

View file

@ -0,0 +1 @@
for i = 1 to 5 for x = 1 to i see "*" next see nl next

View file

@ -0,0 +1,6 @@
for i = 1 to 5
for x = 1 to i
see "*"
next
see nl
next

View file

@ -0,0 +1,6 @@
for (var i = 1; i <= 5; i++) {
for (var j = 1; j <= i; j++) {
print '*'
}
print "\n"
}

View file

@ -0,0 +1,4 @@
for (1..5) { |i|
for (1..i) { print '*' }
print "\n"
}

View file

@ -0,0 +1,4 @@
for i in (1..5) {
for j in (1..i) { print '*' }
print "\n"
}

View file

@ -0,0 +1,4 @@
5.times { |i|
i.times { print '*' }
print "\n"
}

View file

@ -0,0 +1,7 @@
for (var row = 1; row <= 5; row++) {
for (var col = 1; col <= row; col++) {
printf("*");
}
print();
}

View file

@ -0,0 +1,6 @@
for i in 1...5 {
for j in 1...i {
print("*")
}
println()
}

View file

@ -0,0 +1,6 @@
for i in 1..<6 {
for j in 1..<i+1 {
print("*")
}
println()
}

View file

@ -0,0 +1,6 @@
for var i = 1; i <= 5; i++ {
for var j = 1; j <= i; j++ {
print("*")
}
println()
}

View file

@ -0,0 +1,7 @@
for (let i: number = 0; i < 5; ++i) {
let line: string = ""
for(let j: number = 0; j <= i; ++j) {
line += "*"
}
console.log(line)
}

View file

@ -0,0 +1,11 @@
#
# for loop
#
decl int i j
for (set i 0) (< i 5) (inc i)
for (set j 0) (< j (int (+ i 1))) (inc j)
out "*" console
end for
out endl console
end for

View file

@ -0,0 +1,4 @@
for i 1 (i <= 5) ++i
for j 0 (j < i) ++j
pr "*"
(prn)

View file

@ -0,0 +1,4 @@
(DO ((I 1 (+ I 1))) ((> I 5))
(DO ((J 0 (+ J 1))) ((= J I))
(DISPLAY "*"))
(NEWLINE))

View file

@ -0,0 +1,13 @@
# Single-string version using explicit nested loops:
def demo(m):
reduce range(0;m) as $i
(""; reduce range(0;$i) as $j
(.; . + "*" ) + "\n" ) ;
# Stream of strings:
def demo2(m):
range(1;m)
| reduce range(0;.) as $j (""; . + "*");
# Variation of demo2 using an implicit inner loop:
def demo3(m): range(1;m) | "*" * . ;