langs a-z
This commit is contained in:
parent
db842d013d
commit
d066446780
11389 changed files with 98361 additions and 1020 deletions
|
|
@ -0,0 +1,5 @@
|
|||
foreach (i in [1 .. 10])
|
||||
{
|
||||
Write(i);
|
||||
unless (i == 10) Write(", ");
|
||||
}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
/* NetRexx */
|
||||
options replace format comments java crossref savelog symbols nobinary
|
||||
|
||||
say
|
||||
say 'Loops/N plus one half'
|
||||
|
||||
rs = ''
|
||||
istart = 1
|
||||
iend = 10
|
||||
loop i_ = istart to iend
|
||||
rs = rs || i_.right(3)
|
||||
if i_ < iend then do
|
||||
rs = rs','
|
||||
end
|
||||
end i_
|
||||
say rs
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
let last = 10 in
|
||||
for i = 1 to last do
|
||||
print_int i;
|
||||
if i <> last then
|
||||
print_string ", ";
|
||||
done;
|
||||
print_newline();
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
let ints = [1; 2; 3; 4; 5; 6; 7; 8; 9; 10] in
|
||||
let str_ints = List.map string_of_int ints in
|
||||
print_endline (String.concat ", " str_ints);
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
bundle Default {
|
||||
class Hello {
|
||||
function : Main(args : String[]) ~ Nil {
|
||||
for(i := 1; true; i += 1;) {
|
||||
i->Print();
|
||||
if(i = 10) {
|
||||
break;
|
||||
};
|
||||
", "->Print();
|
||||
};
|
||||
'\n'->Print();
|
||||
}
|
||||
}
|
||||
}
|
||||
5
Task/Loops-N-plus-one-half/Oz/loops-n-plus-one-half-1.oz
Normal file
5
Task/Loops-N-plus-one-half/Oz/loops-n-plus-one-half-1.oz
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
for N in {List.number 1 10 1} break:Break do
|
||||
{System.printInfo N}
|
||||
if N == 10 then {Break} end
|
||||
{System.printInfo ", "}
|
||||
end
|
||||
11
Task/Loops-N-plus-one-half/Oz/loops-n-plus-one-half-2.oz
Normal file
11
Task/Loops-N-plus-one-half/Oz/loops-n-plus-one-half-2.oz
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
declare
|
||||
fun {CommaSep Xs}
|
||||
case Xs of nil then nil
|
||||
[] X|Xr then
|
||||
{FoldL Xr
|
||||
fun {$ Z X} Z#", "#X end
|
||||
X}
|
||||
end
|
||||
end
|
||||
in
|
||||
{System.showInfo {CommaSep {List.number 1 10 1}}}
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
n=0;
|
||||
while(1,
|
||||
print1(n++);
|
||||
if(n>9, break);
|
||||
print1(", ")
|
||||
);
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
do i = 1 to 10;
|
||||
put edit (trim(i)) (a);
|
||||
if i < 10 then put edit (', ') (a);
|
||||
end;
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
program numlist(output);
|
||||
|
||||
var
|
||||
i: integer;
|
||||
|
||||
begin
|
||||
for i := 1 to 10 do
|
||||
begin
|
||||
write(i);
|
||||
if i <> 10 then
|
||||
write(', ')
|
||||
end;
|
||||
writeln;
|
||||
end.
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
for 1 .. 10 {
|
||||
.print;
|
||||
last when 10;
|
||||
print ', ';
|
||||
}
|
||||
|
||||
print "\n";
|
||||
10
Task/Loops-N-plus-one-half/Pike/loops-n-plus-one-half.pike
Normal file
10
Task/Loops-N-plus-one-half/Pike/loops-n-plus-one-half.pike
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
int main(){
|
||||
for(int i = 1; i <= 11; i++){
|
||||
write(sprintf("%d",i));
|
||||
if(i == 10){
|
||||
break;
|
||||
}
|
||||
write(", ");
|
||||
}
|
||||
write("\n");
|
||||
}
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
lvars i;
|
||||
for i from 1 to 10 do
|
||||
printf(i, '%p');
|
||||
quitif(i = 10);
|
||||
printf(', ', '%p');
|
||||
endfor;
|
||||
printf('\n', '%p');
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
for ($i = 1; $i -le 10; $i++) {
|
||||
Write-Host -NoNewLine $i
|
||||
if ($i -eq 10) {
|
||||
Write-Host
|
||||
break
|
||||
}
|
||||
Write-Host -NoNewLine ", "
|
||||
}
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
switch (1..10) {
|
||||
{ $true } { Write-Host -NoNewLine $_ }
|
||||
{ $_ -lt 10 } { Write-Host -NoNewLine ", " }
|
||||
{ $_ -eq 10 } { Write-Host }
|
||||
}
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
x=1
|
||||
Repeat
|
||||
Print(Str(x))
|
||||
x+1
|
||||
If x>10: Break: EndIf
|
||||
Print(", ")
|
||||
ForEver
|
||||
13
Task/Loops-N-plus-one-half/REBOL/loops-n-plus-one-half.rebol
Normal file
13
Task/Loops-N-plus-one-half/REBOL/loops-n-plus-one-half.rebol
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
REBOL [
|
||||
Title: "Loop Plus Half"
|
||||
Date: 2009-12-16
|
||||
Author: oofoe
|
||||
URL: http://rosettacode.org/wiki/Loop/n_plus_one_half
|
||||
]
|
||||
|
||||
repeat i 10 [
|
||||
prin i
|
||||
if 10 = i [break]
|
||||
prin ", "
|
||||
]
|
||||
print ""
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
loop str = str lt(i,10) (i = i + 1) :f(out)
|
||||
str = str ne(i,10) ',' :s(loop)
|
||||
out output = str
|
||||
end
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
output('out',1,'-[-r1]')
|
||||
loop i = lt(i,10) i + 1 :f(end)
|
||||
out = i
|
||||
eq(i,10) :s(end)
|
||||
out = ',' :(loop)
|
||||
end
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
iterate (x; [1...10])
|
||||
{
|
||||
print(x);
|
||||
if (x == 10)
|
||||
break;;
|
||||
print(", ");
|
||||
};
|
||||
print("\n");
|
||||
14
Task/Loops-N-plus-one-half/Seed7/loops-n-plus-one-half.seed7
Normal file
14
Task/Loops-N-plus-one-half/Seed7/loops-n-plus-one-half.seed7
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
$ include "seed7_05.s7i";
|
||||
|
||||
const proc: main is func
|
||||
local
|
||||
var integer: number is 0;
|
||||
begin
|
||||
for number range 1 to 10 do
|
||||
write(number);
|
||||
if number < 10 then
|
||||
write(", ")
|
||||
end if;
|
||||
end for;
|
||||
writeln;
|
||||
end func;
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
Local str
|
||||
"" → str
|
||||
For i,1,10
|
||||
str & string(i) → str
|
||||
If i < 10 Then
|
||||
str & "," → str
|
||||
EndIf
|
||||
EndFor
|
||||
Disp str
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
$$ MODE TUSCRIPT
|
||||
line=""
|
||||
LOOP n=1,10
|
||||
line=CONCAT (line,n)
|
||||
IF (n!=10) line=CONCAT (line,", ")
|
||||
ENDLOOP
|
||||
PRINT line
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
for(( Z=1; Z<=10; Z++ )); do
|
||||
echo -e "$Z\c"
|
||||
if (( Z != 10 )); then
|
||||
echo -e ", \c"
|
||||
fi
|
||||
done
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
for ((i=1;i<=$((last=10));i++)); do
|
||||
echo -n $i
|
||||
[ $i -eq $last ] && break
|
||||
echo -n ", "
|
||||
done
|
||||
|
|
@ -0,0 +1 @@
|
|||
yes \ | cat -n | head -n 10 | paste -d\ - <(yes , | head -n 9) | xargs echo
|
||||
4
Task/Loops-N-plus-one-half/V/loops-n-plus-one-half.v
Normal file
4
Task/Loops-N-plus-one-half/V/loops-n-plus-one-half.v
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
[loop
|
||||
[ [10 =] [puts]
|
||||
[true] [dup put ',' put succ loop]
|
||||
] when].
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
for (#1 = 1; 1; #1++) {
|
||||
Num_Ins(#1, LEFT+NOCR)
|
||||
if (#1 == 10) { Break }
|
||||
Ins_Text(", ")
|
||||
}
|
||||
Ins_Newline
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
For i = 1 To 10
|
||||
Console.Write(i)
|
||||
If i = 10 Then Exit For
|
||||
Console.Write(", ")
|
||||
Next
|
||||
14
Task/Loops-N-plus-one-half/XPL0/loops-n-plus-one-half.xpl0
Normal file
14
Task/Loops-N-plus-one-half/XPL0/loops-n-plus-one-half.xpl0
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
codes CrLf=9, IntOut=11, Text=12;
|
||||
int N;
|
||||
[for N:= 1 to 10 do \best way to do this
|
||||
[IntOut(0, N); if N#10 then Text(0, ", ")];
|
||||
CrLf(0);
|
||||
|
||||
N:= 1; \way suggested by task statement
|
||||
loop [IntOut(0, N);
|
||||
if N=10 then quit;
|
||||
Text(0, ", ");
|
||||
N:= N+1;
|
||||
];
|
||||
CrLf(0);
|
||||
]
|
||||
Loading…
Add table
Add a link
Reference in a new issue