Add tasks for all the new languages
This commit is contained in:
parent
9dc3c2bb62
commit
bba7bfd280
13208 changed files with 134745 additions and 0 deletions
1
Task/Loops-For/8th/loops-for.8th
Normal file
1
Task/Loops-For/8th/loops-for.8th
Normal file
|
|
@ -0,0 +1 @@
|
|||
( ( '* putc ) swap times cr ) 1 5 loop
|
||||
21
Task/Loops-For/Apex/loops-for.apex
Normal file
21
Task/Loops-For/Apex/loops-for.apex
Normal 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);
|
||||
}
|
||||
6
Task/Loops-For/Axe/loops-for.axe
Normal file
6
Task/Loops-For/Axe/loops-for.axe
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
ClrHome
|
||||
For(I,1,5)
|
||||
For(J,1,I)
|
||||
Output(J,I,"*")
|
||||
End
|
||||
End
|
||||
9
Task/Loops-For/Ceylon/loops-for.ceylon
Normal file
9
Task/Loops-For/Ceylon/loops-for.ceylon
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
shared void run() {
|
||||
|
||||
for(i in 1..5) {
|
||||
for(j in 1..i) {
|
||||
process.write("*");
|
||||
}
|
||||
print("");
|
||||
}
|
||||
}
|
||||
50
Task/Loops-For/EDSAC-order-code/loops-for.edsac
Normal file
50
Task/Loops-For/EDSAC-order-code/loops-for.edsac
Normal 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 ]
|
||||
6
Task/Loops-For/ERRE/loops-for.erre
Normal file
6
Task/Loops-For/ERRE/loops-for.erre
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
FOR I=1 TO 5 DO
|
||||
FOR J=1 TO I DO
|
||||
PRINT("*";)
|
||||
END FOR
|
||||
PRINT
|
||||
END FOR
|
||||
4
Task/Loops-For/FOCAL/loops-for.focal
Normal file
4
Task/Loops-For/FOCAL/loops-for.focal
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
01.10 FOR I=1,4; DO 2.0
|
||||
|
||||
02.10 FOR J=1,I; TYPE "*"
|
||||
02.20 TYPE !
|
||||
10
Task/Loops-For/FreeBASIC/loops-for.freebasic
Normal file
10
Task/Loops-For/FreeBASIC/loops-for.freebasic
Normal 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
|
||||
7
Task/Loops-For/Futhark/loops-for.futhark
Normal file
7
Task/Loops-For/Futhark/loops-for.futhark
Normal 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
|
||||
7
Task/Loops-For/Hack/loops-for.hack
Normal file
7
Task/Loops-For/Hack/loops-for.hack
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
for($i = 0; $i < 5; $i++) {
|
||||
for($j = 0; $j <= $i; $j++) {
|
||||
echo '*';
|
||||
}
|
||||
|
||||
echo '\n';
|
||||
}
|
||||
31
Task/Loops-For/LC3-Assembly/loops-for.lc3
Normal file
31
Task/Loops-For/LC3-Assembly/loops-for.lc3
Normal 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
|
||||
4
Task/Loops-For/Lasso/loops-for.lasso
Normal file
4
Task/Loops-For/Lasso/loops-for.lasso
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
loop(5) => {^
|
||||
loop(loop_count) => {^ '*' ^}
|
||||
'\r'
|
||||
^}
|
||||
7
Task/Loops-For/Lingo/loops-for.lingo
Normal file
7
Task/Loops-For/Lingo/loops-for.lingo
Normal 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
|
||||
8
Task/Loops-For/LiveCode/loops-for.livecode
Normal file
8
Task/Loops-For/LiveCode/loops-for.livecode
Normal 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
|
||||
10
Task/Loops-For/Morfa/loops-for.morfa
Normal file
10
Task/Loops-For/Morfa/loops-for.morfa
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
import morfa.base;
|
||||
|
||||
for (i in 0..5)
|
||||
{
|
||||
for (j in 0..i+1)
|
||||
{
|
||||
print("*");
|
||||
}
|
||||
println("");
|
||||
}
|
||||
4
Task/Loops-For/Nim/loops-for.nim
Normal file
4
Task/Loops-For/Nim/loops-for.nim
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
for i in 1..5:
|
||||
for i in 1..i:
|
||||
stdout.write("*")
|
||||
echo("")
|
||||
5
Task/Loops-For/Oforth/loops-for.oforth
Normal file
5
Task/Loops-For/Oforth/loops-for.oforth
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
: loopFor(n)
|
||||
| i j |
|
||||
n loop: i [
|
||||
i loop: j [ "*" print ]
|
||||
printcr ;
|
||||
6
Task/Loops-For/Phix/loops-for.phix
Normal file
6
Task/Loops-For/Phix/loops-for.phix
Normal 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
|
||||
1
Task/Loops-For/Ring/loops-for-1.ring
Normal file
1
Task/Loops-For/Ring/loops-for-1.ring
Normal file
|
|
@ -0,0 +1 @@
|
|||
for i = 1 to 5 for x = 1 to i see "*" next see nl next
|
||||
6
Task/Loops-For/Ring/loops-for-2.ring
Normal file
6
Task/Loops-For/Ring/loops-for-2.ring
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
for i = 1 to 5
|
||||
for x = 1 to i
|
||||
see "*"
|
||||
next
|
||||
see nl
|
||||
next
|
||||
6
Task/Loops-For/Sidef/loops-for-1.sidef
Normal file
6
Task/Loops-For/Sidef/loops-for-1.sidef
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
for (var i = 1; i <= 5; i++) {
|
||||
for (var j = 1; j <= i; j++) {
|
||||
print '*'
|
||||
}
|
||||
print "\n"
|
||||
}
|
||||
4
Task/Loops-For/Sidef/loops-for-2.sidef
Normal file
4
Task/Loops-For/Sidef/loops-for-2.sidef
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
for (1..5) { |i|
|
||||
for (1..i) { print '*' }
|
||||
print "\n"
|
||||
}
|
||||
4
Task/Loops-For/Sidef/loops-for-3.sidef
Normal file
4
Task/Loops-For/Sidef/loops-for-3.sidef
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
for i in (1..5) {
|
||||
for j in (1..i) { print '*' }
|
||||
print "\n"
|
||||
}
|
||||
4
Task/Loops-For/Sidef/loops-for-4.sidef
Normal file
4
Task/Loops-For/Sidef/loops-for-4.sidef
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
5.times { |i|
|
||||
i.times { print '*' }
|
||||
print "\n"
|
||||
}
|
||||
7
Task/Loops-For/Sparkling/loops-for.sparkling
Normal file
7
Task/Loops-For/Sparkling/loops-for.sparkling
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
for (var row = 1; row <= 5; row++) {
|
||||
for (var col = 1; col <= row; col++) {
|
||||
printf("*");
|
||||
}
|
||||
|
||||
print();
|
||||
}
|
||||
6
Task/Loops-For/Swift/loops-for-1.swift
Normal file
6
Task/Loops-For/Swift/loops-for-1.swift
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
for i in 1...5 {
|
||||
for j in 1...i {
|
||||
print("*")
|
||||
}
|
||||
println()
|
||||
}
|
||||
6
Task/Loops-For/Swift/loops-for-2.swift
Normal file
6
Task/Loops-For/Swift/loops-for-2.swift
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
for i in 1..<6 {
|
||||
for j in 1..<i+1 {
|
||||
print("*")
|
||||
}
|
||||
println()
|
||||
}
|
||||
6
Task/Loops-For/Swift/loops-for-3.swift
Normal file
6
Task/Loops-For/Swift/loops-for-3.swift
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
for var i = 1; i <= 5; i++ {
|
||||
for var j = 1; j <= i; j++ {
|
||||
print("*")
|
||||
}
|
||||
println()
|
||||
}
|
||||
7
Task/Loops-For/TypeScript/loops-for.type
Normal file
7
Task/Loops-For/TypeScript/loops-for.type
Normal 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)
|
||||
}
|
||||
11
Task/Loops-For/Ursa/loops-for.ursa
Normal file
11
Task/Loops-For/Ursa/loops-for.ursa
Normal 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
|
||||
4
Task/Loops-For/Wart/loops-for.wart
Normal file
4
Task/Loops-For/Wart/loops-for.wart
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
for i 1 (i <= 5) ++i
|
||||
for j 0 (j < i) ++j
|
||||
pr "*"
|
||||
(prn)
|
||||
4
Task/Loops-For/XLISP/loops-for.xlisp
Normal file
4
Task/Loops-For/XLISP/loops-for.xlisp
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
(DO ((I 1 (+ I 1))) ((> I 5))
|
||||
(DO ((J 0 (+ J 1))) ((= J I))
|
||||
(DISPLAY "*"))
|
||||
(NEWLINE))
|
||||
13
Task/Loops-For/jq/loops-for.jq
Normal file
13
Task/Loops-For/jq/loops-for.jq
Normal 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) | "*" * . ;
|
||||
Loading…
Add table
Add a link
Reference in a new issue