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
8
Task/Loops-N-plus-one-half/Axe/loops-n-plus-one-half.axe
Normal file
8
Task/Loops-N-plus-one-half/Axe/loops-n-plus-one-half.axe
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
For(I,1,10)
|
||||
Disp I▶Dec
|
||||
If I=10
|
||||
Disp i
|
||||
Else
|
||||
Disp ","
|
||||
End
|
||||
End
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
FOR I=1 TO 10 DO
|
||||
PRINT(I;)
|
||||
EXIT IF I=10
|
||||
PRINT(", ";)
|
||||
END FOR
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
(string-delimiter "")
|
||||
|
||||
(for ((i (in-range 1 11))) (write i) #:break (= i 10) (write ","))
|
||||
→ 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10
|
||||
|
||||
;; or
|
||||
|
||||
(string-join (range 1 11) ",")
|
||||
→ 1,2,3,4,5,6,7,8,9,10
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
' FB 1.05.0 Win64
|
||||
|
||||
For i As Integer = 1 To 10
|
||||
Print Str(i);
|
||||
If i < 10 Then Print ", ";
|
||||
Next
|
||||
|
||||
Print
|
||||
Sleep
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
include "ConsoleWindow"
|
||||
|
||||
dim as long i, num : num = 10
|
||||
|
||||
for i = 1 to num
|
||||
print i;
|
||||
if i = num then exit for
|
||||
print ",";
|
||||
next i
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
local(out) = ''
|
||||
loop(10) => {
|
||||
#out->append(loop_count)
|
||||
loop_count == 10 ? loop_abort
|
||||
#out->append(', ')
|
||||
}
|
||||
#out
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
repeat with n = 1 to 10
|
||||
put n after loopn
|
||||
if n is not 10 then put comma after loopn
|
||||
end repeat
|
||||
put loopn
|
||||
7
Task/Loops-N-plus-one-half/Nim/loops-n-plus-one-half.nim
Normal file
7
Task/Loops-N-plus-one-half/Nim/loops-n-plus-one-half.nim
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
var s = ""
|
||||
|
||||
for i in 1..10:
|
||||
if s.len > 0: s.add(", ")
|
||||
s.add($i)
|
||||
|
||||
echo s
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
: loopn
|
||||
| i |
|
||||
10 loop: i [ i dup print 10 ifEq: [ break ] "," . ] printcr ;
|
||||
|
|
@ -0,0 +1 @@
|
|||
array{{1..10}}.join(',')
|
||||
|
|
@ -0,0 +1 @@
|
|||
<@ FORLITLIT>10|<@ SAYPOSFOR>...</@><@ ABF>,</@></@>
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
for i=1 to 10 do
|
||||
printf(1,"%d",i)
|
||||
if i=10 then exit end if
|
||||
printf(1,", ")
|
||||
end for
|
||||
|
|
@ -0,0 +1 @@
|
|||
for x = 1 to 10 see x if x=10 exit ok see ", " next see nl
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
for (1..10) { |i|
|
||||
print i;
|
||||
i == 10 && break;
|
||||
print ', ';
|
||||
}
|
||||
|
||||
print "\n";
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
for var i = 1; ; i++ {
|
||||
print(i)
|
||||
if i == 10 {
|
||||
println()
|
||||
break
|
||||
}
|
||||
print(", ")
|
||||
}
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
for i in 1...10 {
|
||||
|
||||
print(i, terminator: i == 10 ? "\n" : ", ")
|
||||
}
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
for var i = 1; ; i++ {
|
||||
print(i, terminator: "")
|
||||
if i == 10 {
|
||||
print("")
|
||||
break
|
||||
}
|
||||
print(", ", terminator: "")
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
decl int i
|
||||
for (set i 1) (< i 11) (inc i)
|
||||
out i console
|
||||
if (= i 10)
|
||||
break
|
||||
end if
|
||||
out ", " console
|
||||
end for
|
||||
out endl console
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
for i 1 (i <= 10) ++i
|
||||
pr i
|
||||
if (i < 10)
|
||||
pr ", "
|
||||
(prn)
|
||||
9
Task/Loops-N-plus-one-half/jq/loops-n-plus-one-half.jq
Normal file
9
Task/Loops-N-plus-one-half/jq/loops-n-plus-one-half.jq
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
One approach is to construct the answer incrementally:
|
||||
def loop_plus_half(m;n):
|
||||
if m<n then reduce range(m+1;n) as $i (m|tostring; . + ", " + ($i|tostring))
|
||||
else empty
|
||||
end;
|
||||
|
||||
# An alternative that is shorter and perhaps closer to the task description because it uses range(m;n) is as follows:
|
||||
def loop_plus_half2(m;n):
|
||||
[range(m;n) | if . == m then . else ", ", . end | tostring] | join("");
|
||||
Loading…
Add table
Add a link
Reference in a new issue