Datasets:
task_url stringlengths 30 116 | task_name stringlengths 2 86 | task_description stringlengths 0 14.4k | language_url stringlengths 2 53 | language_name stringlengths 1 52 | code stringlengths 0 61.9k |
|---|---|---|---|---|---|
http://rosettacode.org/wiki/Ascending_primes | Ascending primes | Generate and show all primes with strictly ascending decimal digits.
Aside: Try solving without peeking at existing solutions. I had a weird idea for generating
a prime sieve faster, which needless to say didn't pan out. The solution may be p(r)etty trivial
but generating them quickly is at least mildly interesting.
T... | #ALGOL_68 | ALGOL 68 | BEGIN # find all primes with strictly increasing digits #
PR read "primes.incl.a68" PR # include prime utilities #
PR read "rows.incl.a68" PR # include array utilities #
[ 1 : 512 ]INT primes; # there will be at most 512 (2^9) primes #
... |
http://rosettacode.org/wiki/Ascending_primes | Ascending primes | Generate and show all primes with strictly ascending decimal digits.
Aside: Try solving without peeking at existing solutions. I had a weird idea for generating
a prime sieve faster, which needless to say didn't pan out. The solution may be p(r)etty trivial
but generating them quickly is at least mildly interesting.
T... | #Arturo | Arturo | ascending?: function [x][
initial: digits x
and? [equal? sort initial initial][equal? size initial size unique initial]
]
candidates: select (1..1456789) ++ [
12345678, 12345679, 12345689, 12345789, 12346789,
12356789, 12456789, 13456789, 23456789, 123456789
] => prime?
ascendingNums: select candid... |
http://rosettacode.org/wiki/Ascending_primes | Ascending primes | Generate and show all primes with strictly ascending decimal digits.
Aside: Try solving without peeking at existing solutions. I had a weird idea for generating
a prime sieve faster, which needless to say didn't pan out. The solution may be p(r)etty trivial
but generating them quickly is at least mildly interesting.
T... | #AWK | AWK |
# syntax: GAWK -f ASCENDING_PRIMES.AWK
BEGIN {
start = 1
stop = 23456789
for (i=start; i<=stop; i++) {
if (is_prime(i)) {
primes++
leng = length(i)
flag = 1
for (j=1; j<leng; j++) {
if (substr(i,j,1) >= substr(i,j+1,1)) {
flag = 0
bre... |
http://rosettacode.org/wiki/Ascending_primes | Ascending primes | Generate and show all primes with strictly ascending decimal digits.
Aside: Try solving without peeking at existing solutions. I had a weird idea for generating
a prime sieve faster, which needless to say didn't pan out. The solution may be p(r)etty trivial
but generating them quickly is at least mildly interesting.
T... | #F.23 | F# |
// Ascending primes. Nigel Galloway: April 19th., 2022
[2;3;5;7]::List.unfold(fun(n,i)->match n with []->None |_->let n=n|>List.map(fun(n,g)->[for n in n.. -1..1->(n-1,i*n+g)])|>List.concat in Some(n|>List.choose(fun(_,n)->if isPrime n then Some n else None),(n|>List.filter(fst>>(<)0),i*10)))([(2,3);(6,7);(8,9)],10)
... |
http://rosettacode.org/wiki/Ascending_primes | Ascending primes | Generate and show all primes with strictly ascending decimal digits.
Aside: Try solving without peeking at existing solutions. I had a weird idea for generating
a prime sieve faster, which needless to say didn't pan out. The solution may be p(r)etty trivial
but generating them quickly is at least mildly interesting.
T... | #Factor | Factor | USING: grouping math math.combinatorics math.functions
math.primes math.ranges prettyprint sequences sequences.extras ;
9 [1,b] all-subsets [ reverse 0 [ 10^ * + ] reduce-index ]
[ prime? ] map-filter 10 group simple-table. |
http://rosettacode.org/wiki/Ascending_primes | Ascending primes | Generate and show all primes with strictly ascending decimal digits.
Aside: Try solving without peeking at existing solutions. I had a weird idea for generating
a prime sieve faster, which needless to say didn't pan out. The solution may be p(r)etty trivial
but generating them quickly is at least mildly interesting.
T... | #Go | Go | package main
import (
"fmt"
"rcu"
"sort"
)
var ascPrimesSet = make(map[int]bool) // avoids duplicates
func generate(first, cand, digits int) {
if digits == 0 {
if rcu.IsPrime(cand) {
ascPrimesSet[cand] = true
}
return
}
for i := first; i < 10; i++ {
... |
http://rosettacode.org/wiki/Ascending_primes | Ascending primes | Generate and show all primes with strictly ascending decimal digits.
Aside: Try solving without peeking at existing solutions. I had a weird idea for generating
a prime sieve faster, which needless to say didn't pan out. The solution may be p(r)etty trivial
but generating them quickly is at least mildly interesting.
T... | #J | J | extend=: {{ y;(1+each i._1+{.y),L:0 y }}
$(#~ 1 p: ])10#.&>([:~.@;extend each)^:# >:i.9
100
10 10$(#~ 1 p: ])10#.&>([:~.@;extend each)^:# >:i.9
2 3 13 23 5 7 17 37 47 67
127 137 347 157 257 457 167 367 467 1237
2347 23... |
http://rosettacode.org/wiki/Ascending_primes | Ascending primes | Generate and show all primes with strictly ascending decimal digits.
Aside: Try solving without peeking at existing solutions. I had a weird idea for generating
a prime sieve faster, which needless to say didn't pan out. The solution may be p(r)etty trivial
but generating them quickly is at least mildly interesting.
T... | #jq | jq |
# Output: the stream of ascending primes, in order
def ascendingPrimes:
# Generate the stream of primes beginning with the digit .
# and with strictly ascending digits, without regard to order
def generate:
# strings
def g:
. as $first
| tonumber as $n
| select($n <= 9)
| $first,... |
http://rosettacode.org/wiki/Ascending_primes | Ascending primes | Generate and show all primes with strictly ascending decimal digits.
Aside: Try solving without peeking at existing solutions. I had a weird idea for generating
a prime sieve faster, which needless to say didn't pan out. The solution may be p(r)etty trivial
but generating them quickly is at least mildly interesting.
T... | #Julia | Julia | using Combinatorics
using Primes
function ascendingprimes()
return filter(isprime, [evalpoly(10, reverse(x))
for x in powerset([1, 2, 3, 4, 5, 6, 7, 8, 9]) if !isempty(x)])
end
foreach(p -> print(rpad(p[2], 10), p[1] % 10 == 0 ? "\n" : ""), enumerate(ascendingprimes()))
@time ascendingprimes()
|
http://rosettacode.org/wiki/Ascending_primes | Ascending primes | Generate and show all primes with strictly ascending decimal digits.
Aside: Try solving without peeking at existing solutions. I had a weird idea for generating
a prime sieve faster, which needless to say didn't pan out. The solution may be p(r)etty trivial
but generating them quickly is at least mildly interesting.
T... | #Lua | Lua | local function is_prime(n)
if n < 2 then return false end
if n % 2 == 0 then return n==2 end
if n % 3 == 0 then return n==3 end
for f = 5, n^0.5, 6 do
if n%f==0 or n%(f+2)==0 then return false end
end
return true
end
local function ascending_primes()
local digits, candidates, primes = {1,2,3,4,5,6,7... |
http://rosettacode.org/wiki/Ascending_primes | Ascending primes | Generate and show all primes with strictly ascending decimal digits.
Aside: Try solving without peeking at existing solutions. I had a weird idea for generating
a prime sieve faster, which needless to say didn't pan out. The solution may be p(r)etty trivial
but generating them quickly is at least mildly interesting.
T... | #Mathematica.2FWolfram_Language | Mathematica/Wolfram Language | ps=Sort@Select[FromDigits /@ Subsets[Range@9, {1, \[Infinity]}], PrimeQ];
Multicolumn[ps, {Automatic, 6}, Appearance -> "Horizontal"] |
http://rosettacode.org/wiki/Ascending_primes | Ascending primes | Generate and show all primes with strictly ascending decimal digits.
Aside: Try solving without peeking at existing solutions. I had a weird idea for generating
a prime sieve faster, which needless to say didn't pan out. The solution may be p(r)etty trivial
but generating them quickly is at least mildly interesting.
T... | #Perl | Perl | #!/usr/bin/perl
use strict; # https://rosettacode.org/wiki/Ascending_primes
use warnings;
use ntheory qw( is_prime );
print join('', map { sprintf "%10d", $_ } sort { $a <=> $b }
grep /./ && is_prime($_),
glob join '', map "{$_,}", 1 .. 9) =~ s/.{50}\K/\n/gr; |
http://rosettacode.org/wiki/Ascending_primes | Ascending primes | Generate and show all primes with strictly ascending decimal digits.
Aside: Try solving without peeking at existing solutions. I had a weird idea for generating
a prime sieve faster, which needless to say didn't pan out. The solution may be p(r)etty trivial
but generating them quickly is at least mildly interesting.
T... | #Phix | Phix | with javascript_semantics
function ascending_primes(sequence res, atom p=0)
for d=remainder(p,10)+1 to 9 do
integer np = p*10+d
if odd(d) and is_prime(np) then res &= np end if
res = ascending_primes(res,np)
end for
return res
end function
sequence r = apply(true,sprintf,{{"%8d"},s... |
http://rosettacode.org/wiki/Ascending_primes | Ascending primes | Generate and show all primes with strictly ascending decimal digits.
Aside: Try solving without peeking at existing solutions. I had a weird idea for generating
a prime sieve faster, which needless to say didn't pan out. The solution may be p(r)etty trivial
but generating them quickly is at least mildly interesting.
T... | #Picat | Picat | import util.
main =>
DP = [N : S in power_set("123456789"), S != [], N = S.to_int, prime(N)].sort,
foreach({P,I} in zip(DP,1..DP.len))
printf("%9d%s",P,cond(I mod 10 == 0,"\n",""))
end,
nl,
println(len=DP.len) |
http://rosettacode.org/wiki/Ascending_primes | Ascending primes | Generate and show all primes with strictly ascending decimal digits.
Aside: Try solving without peeking at existing solutions. I had a weird idea for generating
a prime sieve faster, which needless to say didn't pan out. The solution may be p(r)etty trivial
but generating them quickly is at least mildly interesting.
T... | #Python | Python | from sympy import isprime
def ascending(x=0):
for y in range(x*10 + (x%10) + 1, x*10 + 10):
yield from ascending(y)
yield(y)
print(sorted(x for x in ascending() if isprime(x))) |
http://rosettacode.org/wiki/Ascending_primes | Ascending primes | Generate and show all primes with strictly ascending decimal digits.
Aside: Try solving without peeking at existing solutions. I had a weird idea for generating
a prime sieve faster, which needless to say didn't pan out. The solution may be p(r)etty trivial
but generating them quickly is at least mildly interesting.
T... | #Quackery | Quackery | [ 0 swap witheach
[ swap 10 * + ] ] is digits->n ( [ --> n )
[]
' [ 1 2 3 4 5 6 7 8 9 ] powerset
witheach
[ digits->n dup isprime
iff join else drop ]
sort echo |
http://rosettacode.org/wiki/Ascending_primes | Ascending primes | Generate and show all primes with strictly ascending decimal digits.
Aside: Try solving without peeking at existing solutions. I had a weird idea for generating
a prime sieve faster, which needless to say didn't pan out. The solution may be p(r)etty trivial
but generating them quickly is at least mildly interesting.
T... | #Raku | Raku | put (flat 2, 3, 5, 7, sort +*, gather (1..8).map: &recurse ).batch(10)».fmt("%8d").join: "\n";
sub recurse ($str) {
.take for ($str X~ (3, 7, 9)).grep: { .is-prime && [<] .comb };
recurse $str × 10 + $_ for $str % 10 ^.. 9;
}
printf "%.3f seconds", now - INIT now; |
http://rosettacode.org/wiki/Ascending_primes | Ascending primes | Generate and show all primes with strictly ascending decimal digits.
Aside: Try solving without peeking at existing solutions. I had a weird idea for generating
a prime sieve faster, which needless to say didn't pan out. The solution may be p(r)etty trivial
but generating them quickly is at least mildly interesting.
T... | #Ring | Ring |
load "stdlibcore.ring"
limit = 1000
row = 0
for n = 1 to limit
flag = 0
strn = string(n)
if isprime(n) = 1
for m = 1 to len(strn)-1
if number(substr(strn,m)) > number(substr(strn,m+1))
flag = 1
ok
next
if flag = 1
row++
see "... |
http://rosettacode.org/wiki/Ascending_primes | Ascending primes | Generate and show all primes with strictly ascending decimal digits.
Aside: Try solving without peeking at existing solutions. I had a weird idea for generating
a prime sieve faster, which needless to say didn't pan out. The solution may be p(r)etty trivial
but generating them quickly is at least mildly interesting.
T... | #Sidef | Sidef | func primes_with_ascending_digits(base = 10) {
var list = []
var digits = @(1..^base -> flip)
var end_digits = digits.grep { .is_coprime(base) }
list << digits.grep { .is_prime && !.is_coprime(base) }...
for k in (0 .. digits.end) {
digits.combinations(k, {|*a|
var v = a.di... |
http://rosettacode.org/wiki/Ascending_primes | Ascending primes | Generate and show all primes with strictly ascending decimal digits.
Aside: Try solving without peeking at existing solutions. I had a weird idea for generating
a prime sieve faster, which needless to say didn't pan out. The solution may be p(r)etty trivial
but generating them quickly is at least mildly interesting.
T... | #Vlang | Vlang | fn is_prime(n int) bool {
if n < 2 {
return false
} else if n%2 == 0 {
return n == 2
} else if n%3 == 0 {
return n == 3
} else {
mut d := 5
for d*d <= n {
if n%d == 0 {
return false
}
d += 2
if n%d ==... |
http://rosettacode.org/wiki/Ascending_primes | Ascending primes | Generate and show all primes with strictly ascending decimal digits.
Aside: Try solving without peeking at existing solutions. I had a weird idea for generating
a prime sieve faster, which needless to say didn't pan out. The solution may be p(r)etty trivial
but generating them quickly is at least mildly interesting.
T... | #Wren | Wren | import "./math" for Int
import "./seq" for Lst
import "./fmt" for Fmt
var isAscending = Fn.new { |n|
if (n < 10) return true
var digits = Int.digits(n)
for (i in 1...digits.count) {
if (digits[i] <= digits[i-1]) return false
}
return true
}
var higherPrimes = []
var candidates = [
... |
http://rosettacode.org/wiki/Ascending_primes | Ascending primes | Generate and show all primes with strictly ascending decimal digits.
Aside: Try solving without peeking at existing solutions. I had a weird idea for generating
a prime sieve faster, which needless to say didn't pan out. The solution may be p(r)etty trivial
but generating them quickly is at least mildly interesting.
T... | #XPL0 | XPL0 | func IsPrime(N); \Return 'true' if N is prime
int N, I;
[if N <= 2 then return N = 2;
if (N&1) = 0 then \even >2\ return false;
for I:= 3 to sqrt(N) do
[if rem(N/I) = 0 then return false;
I:= I+1;
];
return true;
];
func Ascending(N); \Return 'true' if digits are ascending
int N, D;
[N:= N/1... |
http://rosettacode.org/wiki/Array_concatenation | Array concatenation | Task
Show how to concatenate two arrays in your language.
If this is as simple as array1 + array2, so be it.
| #11l | 11l | V arr1 = [1, 2, 3]
V arr2 = [4, 5, 6]
print(arr1 [+] arr2) |
http://rosettacode.org/wiki/Array_concatenation | Array concatenation | Task
Show how to concatenate two arrays in your language.
If this is as simple as array1 + array2, so be it.
| #68000_Assembly | 68000 Assembly | ArrayRam equ $00FF2000 ;this label points to 4k of free space.
;concatenate Array1 + Array2
LEA ArrayRam,A0
LEA Array1,A1
MOVE.W #5-1,D1 ;LEN(Array1), measured in words.
JSR memcpy_w
;after this, A0 will point to the destination of the second array.
LEA Array2,A1 ;even though the source arrays are stored back... |
http://rosettacode.org/wiki/Array_concatenation | Array concatenation | Task
Show how to concatenate two arrays in your language.
If this is as simple as array1 + array2, so be it.
| #8th | 8th |
[1,2,3] [4,5,6] a:+ .
|
http://rosettacode.org/wiki/Array_concatenation | Array concatenation | Task
Show how to concatenate two arrays in your language.
If this is as simple as array1 + array2, so be it.
| #AArch64_Assembly | AArch64 Assembly |
/* ARM assembly AARCH64 Raspberry PI 3B */
/* program concAreaString.s */
/*******************************************/
/* Constantes file */
/*******************************************/
/* for this file see task include a file in language AArch64 assembly*/
.include "../includeConstante... |
http://rosettacode.org/wiki/Array_concatenation | Array concatenation | Task
Show how to concatenate two arrays in your language.
If this is as simple as array1 + array2, so be it.
| #ABAP | ABAP |
report z_array_concatenation.
data(itab1) = value int4_table( ( 1 ) ( 2 ) ( 3 ) ).
data(itab2) = value int4_table( ( 4 ) ( 5 ) ( 6 ) ).
append lines of itab2 to itab1.
loop at itab1 assigning field-symbol(<line>).
write <line>.
endloop.
|
http://rosettacode.org/wiki/Array_concatenation | Array concatenation | Task
Show how to concatenate two arrays in your language.
If this is as simple as array1 + array2, so be it.
| #ACL2 | ACL2 | (append xs ys) |
http://rosettacode.org/wiki/Array_concatenation | Array concatenation | Task
Show how to concatenate two arrays in your language.
If this is as simple as array1 + array2, so be it.
| #Action.21 | Action! | BYTE FUNC Concat(INT ARRAY src1,src2,dst BYTE size1,size2)
BYTE i
FOR i=0 TO size1-1
DO
dst(i)=src1(i)
OD
FOR i=0 TO size2-1
DO
dst(size1+i)=src2(i)
OD
RETURN (size1+size2)
PROC PrintArray(INT ARRAY a BYTE size)
BYTE i
Put('[)
FOR i=0 TO size-1
DO
PrintI(a(i))
IF i<size-1 THE... |
http://rosettacode.org/wiki/Array_concatenation | Array concatenation | Task
Show how to concatenate two arrays in your language.
If this is as simple as array1 + array2, so be it.
| #ActionScript | ActionScript | var array1:Array = new Array(1, 2, 3);
var array2:Array = new Array(4, 5, 6);
var array3:Array = array1.concat(array2); //[1, 2, 3, 4, 5, 6] |
http://rosettacode.org/wiki/Array_concatenation | Array concatenation | Task
Show how to concatenate two arrays in your language.
If this is as simple as array1 + array2, so be it.
| #Ada | Ada | type T is array (Positive range <>) of Integer;
X : T := (1, 2, 3);
Y : T := X & (4, 5, 6); -- Concatenate X and (4, 5, 6) |
http://rosettacode.org/wiki/Array_concatenation | Array concatenation | Task
Show how to concatenate two arrays in your language.
If this is as simple as array1 + array2, so be it.
| #Aime | Aime | ac(list a, b)
{
list o;
o.copy(a);
b.ucall(l_append, 1, o);
o;
}
main(void)
{
list a, b, c;
a = list(1, 2, 3, 4);
b = list(5, 6, 7, 8);
c = ac(a, b);
c.ucall(o_, 1, " ");
0;
} |
http://rosettacode.org/wiki/Array_concatenation | Array concatenation | Task
Show how to concatenate two arrays in your language.
If this is as simple as array1 + array2, so be it.
| #ALGOL_68 | ALGOL 68 | MODE ARGTYPE = INT;
MODE ARGLIST = FLEX[0]ARGTYPE;
OP + = (ARGLIST a, b)ARGLIST: (
[LWB a:UPB a - LWB a + 1 + UPB b - LWB b + 1 ]ARGTYPE out;
(
out[LWB a:UPB a]:=a,
out[UPB a+1:]:=b
);
out
);
# Append #
OP +:= = (REF ARGLIST lhs, ARGLIST rhs)ARGLIST: lhs := lhs + rhs;
OP PLUSAB = (REF ARGLIST lh... |
http://rosettacode.org/wiki/Array_concatenation | Array concatenation | Task
Show how to concatenate two arrays in your language.
If this is as simple as array1 + array2, so be it.
| #ALGOL_W | ALGOL W | begin
integer array a ( 1 :: 5 );
integer array b ( 2 :: 4 );
integer array c ( 1 :: 8 );
% concatenates the arrays a and b into c %
% the lower and upper bounds of each array must be specified in %
% the corresponding *Lb and *Ub parameters %
pr... |
http://rosettacode.org/wiki/Array_concatenation | Array concatenation | Task
Show how to concatenate two arrays in your language.
If this is as simple as array1 + array2, so be it.
| #Amazing_Hopper | Amazing Hopper |
#include <hbasic.h>
Begin
a1 = {}
a2 = {}
Take(100,"Hola",0.056,"Mundo!"), and Push All(a1)
Take("Segundo",0,"array",~True,~False), and Push All(a2)
Concat (a1, a2) and Print ( a2, Newl )
End
|
http://rosettacode.org/wiki/Array_concatenation | Array concatenation | Task
Show how to concatenate two arrays in your language.
If this is as simple as array1 + array2, so be it.
| #AntLang | AntLang | a:<1; <2; 3>>
b: <"Hello"; 42>
c: a,b |
http://rosettacode.org/wiki/Array_concatenation | Array concatenation | Task
Show how to concatenate two arrays in your language.
If this is as simple as array1 + array2, so be it.
| #Apex | Apex | List<String> listA = new List<String> { 'apple' };
List<String> listB = new List<String> { 'banana' };
listA.addAll(listB);
System.debug(listA); // Prints (apple, banana) |
http://rosettacode.org/wiki/Array_concatenation | Array concatenation | Task
Show how to concatenate two arrays in your language.
If this is as simple as array1 + array2, so be it.
| #APL | APL |
1 2 3 , 4 5 6
1 2 3 4 5 6
|
http://rosettacode.org/wiki/Array_concatenation | Array concatenation | Task
Show how to concatenate two arrays in your language.
If this is as simple as array1 + array2, so be it.
| #AppleScript | AppleScript |
set listA to {1, 2, 3}
set listB to {4, 5, 6}
return listA & listB
|
http://rosettacode.org/wiki/Array_concatenation | Array concatenation | Task
Show how to concatenate two arrays in your language.
If this is as simple as array1 + array2, so be it.
| #ARM_Assembly | ARM Assembly |
/* ARM assembly Raspberry PI */
/* program concAreaString.s */
/* Constantes */
.equ STDOUT, 1 @ Linux output console
.equ EXIT, 1 @ Linux syscall
.equ WRITE, 4 @ Linux syscall
.equ NBMAXITEMS, 20 @
/* Initialized data */
.data
szMessLenArea: .ascii "The length of area 3 is : "
sZoneconv:... |
http://rosettacode.org/wiki/Array_concatenation | Array concatenation | Task
Show how to concatenate two arrays in your language.
If this is as simple as array1 + array2, so be it.
| #Arturo | Arturo | arr1: [1 2 3]
arr2: ["four" "five" "six"]
print arr1 ++ arr2 |
http://rosettacode.org/wiki/Array_concatenation | Array concatenation | Task
Show how to concatenate two arrays in your language.
If this is as simple as array1 + array2, so be it.
| #ATS | ATS | (* The Rosetta Code array concatenation task, in ATS2. *)
(* In a way, the task is misleading: in a language such as ATS, one
can always devise a very-easy-to-use array type, put the code for
that in a library, and overload operators. Thus we can have
"array1 + array2" as array concatenation in ATS, complete... |
http://rosettacode.org/wiki/Array_concatenation | Array concatenation | Task
Show how to concatenate two arrays in your language.
If this is as simple as array1 + array2, so be it.
| #AutoHotkey | AutoHotkey | List1 := [1, 2, 3]
List2 := [4, 5, 6]
cList := Arr_concatenate(List1, List2)
MsgBox % Arr_disp(cList) ; [1, 2, 3, 4, 5, 6]
Arr_concatenate(p*) {
res := Object()
For each, obj in p
For each, value in obj
res.Insert(value)
return res
}
Arr_disp(arr) {
for each, value in arr
... |
http://rosettacode.org/wiki/Array_concatenation | Array concatenation | Task
Show how to concatenate two arrays in your language.
If this is as simple as array1 + array2, so be it.
| #AutoIt | AutoIt |
_ArrayConcatenate($avArray, $avArray2)
Func _ArrayConcatenate(ByRef $avArrayTarget, Const ByRef $avArraySource, $iStart = 0)
If Not IsArray($avArrayTarget) Then Return SetError(1, 0, 0)
If Not IsArray($avArraySource) Then Return SetError(2, 0, 0)
If UBound($avArrayTarget, 0) <> 1 Then
If UBound($avArraySource, 0... |
http://rosettacode.org/wiki/Array_concatenation | Array concatenation | Task
Show how to concatenate two arrays in your language.
If this is as simple as array1 + array2, so be it.
| #Avail | Avail | <1, 2, 3> ++ <¢a, ¢b, ¢c> |
http://rosettacode.org/wiki/Array_concatenation | Array concatenation | Task
Show how to concatenate two arrays in your language.
If this is as simple as array1 + array2, so be it.
| #AWK | AWK | #!/usr/bin/awk -f
BEGIN {
split("cul-de-sac",a,"-")
split("1-2-3",b,"-")
concat_array(a,b,c)
for (i in c) {
print i,c[i]
}
}
function concat_array(a,b,c, nc) {
for (i in a) {
c[++nc]=a[i]
}
for (i in b) {
c[++nc]=b[i]
}
} |
http://rosettacode.org/wiki/Array_concatenation | Array concatenation | Task
Show how to concatenate two arrays in your language.
If this is as simple as array1 + array2, so be it.
| #Babel | Babel | [1 2 3] [4 5 6] cat ; |
http://rosettacode.org/wiki/Array_concatenation | Array concatenation | Task
Show how to concatenate two arrays in your language.
If this is as simple as array1 + array2, so be it.
| #bash | bash | x=("1 2" "3 4")
y=(5 6)
sum=( "${x[@]}" "${y[@]}" )
for i in "${sum[@]}" ; do echo "$i" ; done
1 2
3 4
5
6 |
http://rosettacode.org/wiki/Array_concatenation | Array concatenation | Task
Show how to concatenate two arrays in your language.
If this is as simple as array1 + array2, so be it.
| #BASIC | BASIC | DECLARE a[] = { 1, 2, 3, 4, 5 }
DECLARE b[] = { 6, 7, 8, 9, 10 }
DECLARE c ARRAY UBOUND(a) + UBOUND(b)
FOR x = 0 TO 4
c[x] = a[x]
c[x+5] = b[x]
NEXT |
http://rosettacode.org/wiki/Array_concatenation | Array concatenation | Task
Show how to concatenate two arrays in your language.
If this is as simple as array1 + array2, so be it.
| #BASIC256 | BASIC256 | arraybase 1
global c
dimen = 5
dim a(dimen)
dim b(dimen)
# Array initialization
for i = 1 to dimen
a[i] = i
b[i] = i + dimen
next i
nt = ConcatArrays(a, b)
for i = 1 to nt
print c[i];
if i < nt then print ", ";
next i
end
function ConcatArrays(a, b)
ta = a[?]
tb = b[?]
nt = ta + tb
redim c(nt)
for ... |
http://rosettacode.org/wiki/Array_concatenation | Array concatenation | Task
Show how to concatenate two arrays in your language.
If this is as simple as array1 + array2, so be it.
| #BQN | BQN | 1‿2‿3 ∾ 4‿5‿6 |
http://rosettacode.org/wiki/Array_concatenation | Array concatenation | Task
Show how to concatenate two arrays in your language.
If this is as simple as array1 + array2, so be it.
| #Bracmat | Bracmat | {?} (a,b,c,d,e),(n,m)
{!} a,b,c,d,e,n,m
{?} (a,m,y),(b,n,y,z)
{!} a,m,y,b,n,y,z
{?} (a m y) (b n y z)
{!} a m y b n y z
{?} (a+m+y)+(b+n+y+z)
{!} a+b+m+n+2*y+z
{?} (a*m*y)*(b*n*y*z)
{!} a*b*m*n*y^2*z |
http://rosettacode.org/wiki/Array_concatenation | Array concatenation | Task
Show how to concatenate two arrays in your language.
If this is as simple as array1 + array2, so be it.
| #Burlesque | Burlesque |
blsq ) {1 2 3}{4 5 6}_+
{1 2 3 4 5 6}
|
http://rosettacode.org/wiki/Array_concatenation | Array concatenation | Task
Show how to concatenate two arrays in your language.
If this is as simple as array1 + array2, so be it.
| #C | C | #include <stdlib.h>
#include <stdio.h>
#include <string.h>
#define ARRAY_CONCAT(TYPE, A, An, B, Bn) \
(TYPE *)array_concat((const void *)(A), (An), (const void *)(B), (Bn), sizeof(TYPE));
void *array_concat(const void *a, size_t an,
const void *b, size_t bn, size_t s)
{
char *p = malloc(s * (... |
http://rosettacode.org/wiki/Array_concatenation | Array concatenation | Task
Show how to concatenate two arrays in your language.
If this is as simple as array1 + array2, so be it.
| #C.23 | C# | using System;
namespace RosettaCode
{
class Program
{
static void Main(string[] args)
{
int[] a = { 1, 2, 3 };
int[] b = { 4, 5, 6 };
int[] c = new int[a.Length + b.Length];
a.CopyTo(c, 0);
b.CopyTo(c, a.Length);
forea... |
http://rosettacode.org/wiki/Array_concatenation | Array concatenation | Task
Show how to concatenate two arrays in your language.
If this is as simple as array1 + array2, so be it.
| #C.2B.2B | C++ | #include <vector>
#include <iostream>
int main()
{
std::vector<int> a(3), b(4);
a[0] = 11; a[1] = 12; a[2] = 13;
b[0] = 21; b[1] = 22; b[2] = 23; b[3] = 24;
a.insert(a.end(), b.begin(), b.end());
for (int i = 0; i < a.size(); ++i)
std::cout << "a[" << i << "] = " << a[i] << "\n";
} |
http://rosettacode.org/wiki/Array_concatenation | Array concatenation | Task
Show how to concatenate two arrays in your language.
If this is as simple as array1 + array2, so be it.
| #Ceylon | Ceylon | shared void arrayConcatenation() {
value a = Array {1, 2, 3};
value b = Array {4, 5, 6};
value c = concatenate(a, b);
print(c);
} |
http://rosettacode.org/wiki/Array_concatenation | Array concatenation | Task
Show how to concatenate two arrays in your language.
If this is as simple as array1 + array2, so be it.
| #Clojure | Clojure | (concat [1 2 3] [4 5 6]) |
http://rosettacode.org/wiki/Array_concatenation | Array concatenation | Task
Show how to concatenate two arrays in your language.
If this is as simple as array1 + array2, so be it.
| #COBOL | COBOL | identification division.
program-id. array-concat.
environment division.
configuration section.
repository.
function all intrinsic.
data division.
working-storage section.
01 table-one.
05 int-field pic 999 occurs 0 to 5 depending on t1.
... |
http://rosettacode.org/wiki/Array_concatenation | Array concatenation | Task
Show how to concatenate two arrays in your language.
If this is as simple as array1 + array2, so be it.
| #CoffeeScript | CoffeeScript |
# like in JavaScript
a = [1, 2, 3]
b = [4, 5, 6]
c = a.concat b
|
http://rosettacode.org/wiki/Array_concatenation | Array concatenation | Task
Show how to concatenate two arrays in your language.
If this is as simple as array1 + array2, so be it.
| #Common_Lisp | Common Lisp | (concatenate 'vector #(0 1 2 3) #(4 5 6 7))
=> #(0 1 2 3 4 5 6 7) |
http://rosettacode.org/wiki/Array_concatenation | Array concatenation | Task
Show how to concatenate two arrays in your language.
If this is as simple as array1 + array2, so be it.
| #Component_Pascal | Component Pascal |
MODULE ArrayConcat;
IMPORT StdLog;
PROCEDURE Concat(x: ARRAY OF INTEGER; y: ARRAY OF INTEGER; OUT z: ARRAY OF INTEGER);
VAR
i: INTEGER;
BEGIN
ASSERT(LEN(x) + LEN(y) <= LEN(z));
FOR i := 0 TO LEN(x) - 1 DO z[i] := x[i] END;
FOR i := 0 TO LEN(y) - 1 DO z[i + LEN(x)] := y[i] END
END Concat;
PROCEDURE Concat2(x: ... |
http://rosettacode.org/wiki/Array_concatenation | Array concatenation | Task
Show how to concatenate two arrays in your language.
If this is as simple as array1 + array2, so be it.
| #Crystal | Crystal | arr1 = [1, 2, 3]
arr2 = ["foo", "bar", "baz"]
arr1 + arr2 #=> [1, 2, 3, "foo", "bar", "baz"] |
http://rosettacode.org/wiki/Array_concatenation | Array concatenation | Task
Show how to concatenate two arrays in your language.
If this is as simple as array1 + array2, so be it.
| #D | D | import std.stdio: writeln;
void main() {
int[] a = [1, 2];
int[] b = [4, 5, 6];
writeln(a, " ~ ", b, " = ", a ~ b);
} |
http://rosettacode.org/wiki/Array_concatenation | Array concatenation | Task
Show how to concatenate two arrays in your language.
If this is as simple as array1 + array2, so be it.
| #Delphi | Delphi | type
TReturnArray = array of integer; //you need to define a type to be able to return it
function ConcatArray(a1,a2:array of integer):TReturnArray;
var
i,r:integer;
begin
{ Low(array) is not necessarily 0 }
SetLength(result,High(a1)-Low(a1)+High(a2)-Low(a2)+2); //BAD idea to set a length you won't release, j... |
http://rosettacode.org/wiki/Array_concatenation | Array concatenation | Task
Show how to concatenate two arrays in your language.
If this is as simple as array1 + array2, so be it.
| #Dyalect | Dyalect | var xs = [1,2,3]
var ys = [4,5,6]
var alls = Array.Concat(xs, ys)
print(alls) |
http://rosettacode.org/wiki/Array_concatenation | Array concatenation | Task
Show how to concatenate two arrays in your language.
If this is as simple as array1 + array2, so be it.
| #E | E | ? [1,2] + [3,4]
# value: [1, 2, 3, 4] |
http://rosettacode.org/wiki/Array_concatenation | Array concatenation | Task
Show how to concatenate two arrays in your language.
If this is as simple as array1 + array2, so be it.
| #EasyLang | EasyLang | a[] = [ 1 2 3 ]
b[] = [ 4 5 6 ]
c[] = a[]
while i < len b[]
c[] &= b[i]
i += 1
.
print c[] |
http://rosettacode.org/wiki/Array_concatenation | Array concatenation | Task
Show how to concatenate two arrays in your language.
If this is as simple as array1 + array2, so be it.
| #EchoLisp | EchoLisp |
;;;; VECTORS
(vector-append (make-vector 6 42) (make-vector 4 666))
→ #( 42 42 42 42 42 42 666 666 666 666)
;;;; LISTS
(append (iota 5) (iota 6))
→ (0 1 2 3 4 0 1 2 3 4 5)
;; NB - append may also be used with sequences (lazy lists)
(lib 'sequences)
(take (append [1 .. 7] [7 6 .. 0]) #:all)
→ (1 2 3 4... |
http://rosettacode.org/wiki/Array_concatenation | Array concatenation | Task
Show how to concatenate two arrays in your language.
If this is as simple as array1 + array2, so be it.
| #ECL | ECL |
A := [1, 2, 3, 4];
B := [5, 6, 7, 8];
C := A + B; |
http://rosettacode.org/wiki/Array_concatenation | Array concatenation | Task
Show how to concatenate two arrays in your language.
If this is as simple as array1 + array2, so be it.
| #Efene | Efene |
@public
run = fn () {
A = [1, 2, 3, 4]
B = [5, 6, 7, 8]
C = A ++ B
D = lists.append([A, B])
io.format("~p~n", [C])
io.format("~p~n", [D])
} |
http://rosettacode.org/wiki/Array_concatenation | Array concatenation | Task
Show how to concatenate two arrays in your language.
If this is as simple as array1 + array2, so be it.
| #EGL | EGL |
program ArrayConcatenation
function main()
a int[] = [ 1, 2, 3 ];
b int[] = [ 4, 5, 6 ];
c int[];
c.appendAll(a);
c.appendAll(b);
for (i int from 1 to c.getSize())
SysLib.writeStdout("Element " :: i :: " = " :: c[i]);
end
end
end
|
http://rosettacode.org/wiki/Array_concatenation | Array concatenation | Task
Show how to concatenate two arrays in your language.
If this is as simple as array1 + array2, so be it.
| #Ela | Ela | xs = [1,2,3]
ys = [4,5,6]
xs ++ ys |
http://rosettacode.org/wiki/Array_concatenation | Array concatenation | Task
Show how to concatenate two arrays in your language.
If this is as simple as array1 + array2, so be it.
| #Elena | Elena | import extensions;
public program()
{
var a := new int[]{1,2,3};
var b := new int[]{4,5};
console.printLine(
"(",a.asEnumerable(),") + (",b.asEnumerable(),
") = (",(a + b).asEnumerable(),")").readChar();
} |
http://rosettacode.org/wiki/Array_concatenation | Array concatenation | Task
Show how to concatenate two arrays in your language.
If this is as simple as array1 + array2, so be it.
| #Elixir | Elixir | iex(1)> [1, 2, 3] ++ [4, 5, 6]
[1, 2, 3, 4, 5, 6]
iex(2)> Enum.concat([[1, [2], 3], [4], [5, 6]])
[1, [2], 3, 4, 5, 6]
iex(3)> Enum.concat([1..3, [4,5,6], 7..9])
[1, 2, 3, 4, 5, 6, 7, 8, 9] |
http://rosettacode.org/wiki/Array_concatenation | Array concatenation | Task
Show how to concatenate two arrays in your language.
If this is as simple as array1 + array2, so be it.
| #Elm | Elm | import Element exposing (show, toHtml) -- elm-package install evancz/elm-graphics
import Html.App exposing (beginnerProgram)
import Array exposing (Array, append, initialize)
xs : Array Int
xs =
initialize 3 identity -- [0, 1, 2]
ys : Array Int
ys =
initialize 3 <| (+) 3 -- [3, 4, 5]
main = beginnerProgr... |
http://rosettacode.org/wiki/Array_concatenation | Array concatenation | Task
Show how to concatenate two arrays in your language.
If this is as simple as array1 + array2, so be it.
| #Emacs_Lisp | Emacs Lisp | (vconcat '[1 2 3] '[4 5] '[6 7 8 9])
=> [1 2 3 4 5 6 7 8 9] |
http://rosettacode.org/wiki/Array_concatenation | Array concatenation | Task
Show how to concatenate two arrays in your language.
If this is as simple as array1 + array2, so be it.
| #Erlang | Erlang |
1> [1, 2, 3] ++ [4, 5, 6].
[1,2,3,4,5,6]
2> lists:append([1, 2, 3], [4, 5, 6]).
[1,2,3,4,5,6]
3>
|
http://rosettacode.org/wiki/Array_concatenation | Array concatenation | Task
Show how to concatenate two arrays in your language.
If this is as simple as array1 + array2, so be it.
| #ERRE | ERRE |
PROGRAM ARRAY_CONCAT
DIM A[5],B[5],C[10]
!
! for rosettacode.org
!
BEGIN
DATA(1,2,3,4,5)
DATA(6,7,8,9,0)
FOR I=1 TO 5 DO ! read array A[.]
READ(A[I])
END FOR
FOR I=1 TO 5 DO ! read array B[.]
READ(B[I])
END FOR
FOR I=1 TO 10 DO ! append B[.] to A[.]
IF I>5 THEN
C[I]=B[I-5]... |
http://rosettacode.org/wiki/Array_concatenation | Array concatenation | Task
Show how to concatenate two arrays in your language.
If this is as simple as array1 + array2, so be it.
| #Euphoria | Euphoria | sequence s1,s2,s3
s1 = {1,2,3}
s2 = {4,5,6}
s3 = s1 & s2
? s3 |
http://rosettacode.org/wiki/Array_concatenation | Array concatenation | Task
Show how to concatenate two arrays in your language.
If this is as simple as array1 + array2, so be it.
| #F.23 | F# | let a = [|1; 2; 3|]
let b = [|4; 5; 6;|]
let c = Array.append a b |
http://rosettacode.org/wiki/Array_concatenation | Array concatenation | Task
Show how to concatenate two arrays in your language.
If this is as simple as array1 + array2, so be it.
| #Factor | Factor | append |
http://rosettacode.org/wiki/Array_concatenation | Array concatenation | Task
Show how to concatenate two arrays in your language.
If this is as simple as array1 + array2, so be it.
| #Fantom | Fantom |
> a := [1,2,3]
> b := [4,5,6]
> a.addAll(b)
> a
[1,2,3,4,5,6]
|
http://rosettacode.org/wiki/Array_concatenation | Array concatenation | Task
Show how to concatenate two arrays in your language.
If this is as simple as array1 + array2, so be it.
| #FBSL | FBSL | #APPTYPE CONSOLE
DIM aint[] ={1, 2, 3}, astr[] ={"one", "two", "three"}, asng[] ={!1, !2, !3}
FOREACH DIM e IN ARRAYMERGE(aint, astr, asng)
PRINT e, " ";
NEXT
PAUSE |
http://rosettacode.org/wiki/Array_concatenation | Array concatenation | Task
Show how to concatenate two arrays in your language.
If this is as simple as array1 + array2, so be it.
| #Forth | Forth | : $!+ ( a u a' -- a'+u )
2dup + >r swap move r> ;
: cat ( a2 u2 a1 u1 -- a3 u1+u2 )
align here dup >r $!+ $!+ r> tuck - dup allot ;
\ TEST
create a1 1 , 2 , 3 ,
create a2 4 , 5 ,
a2 2 cells a1 3 cells cat dump
8018425F0: 01 00 00 00 00 00 00 00 - 02 00 00 00 00 00 00 00 ................
801842600: 03 0... |
http://rosettacode.org/wiki/Array_concatenation | Array concatenation | Task
Show how to concatenate two arrays in your language.
If this is as simple as array1 + array2, so be it.
| #Fortran | Fortran | program Concat_Arrays
implicit none
! Note: in Fortran 90 you must use the old array delimiters (/ , /)
integer, dimension(3) :: a = [1, 2, 3] ! (/1, 2, 3/)
integer, dimension(3) :: b = [4, 5, 6] ! (/4, 5, 6/)
integer, dimension(:), allocatable :: c, d
allocate(c(size(a)+size(b)))
c(1 : size(a)) = a
... |
http://rosettacode.org/wiki/Array_concatenation | Array concatenation | Task
Show how to concatenate two arrays in your language.
If this is as simple as array1 + array2, so be it.
| #Free_Pascal | Free Pascal | array2 := array0 + array1 |
http://rosettacode.org/wiki/Array_concatenation | Array concatenation | Task
Show how to concatenate two arrays in your language.
If this is as simple as array1 + array2, so be it.
| #FreeBASIC | FreeBASIC |
' FB 1.05.0 Win64
Sub ConcatArrays(a() As String, b() As String, c() As String)
Dim aSize As Integer = UBound(a) - LBound(a) + 1
Dim bSize As Integer = UBound(b) - LBound(b) + 1
Dim cSize As Integer = aSize + bSize
Redim c(0 To cSize - 1)
Dim i As Integer
For i = 0 To aSize - 1
c(i) = a(LBoun... |
http://rosettacode.org/wiki/Array_concatenation | Array concatenation | Task
Show how to concatenate two arrays in your language.
If this is as simple as array1 + array2, so be it.
| #Frink | Frink |
a = [1,2]
b = [3,4]
a.pushAll[b]
|
http://rosettacode.org/wiki/Array_concatenation | Array concatenation | Task
Show how to concatenate two arrays in your language.
If this is as simple as array1 + array2, so be it.
| #FunL | FunL | arr1 = array( [1, 2, 3] )
arr2 = array( [4, 5, 6] )
arr3 = array( [7, 8, 9] )
println( arr1 + arr2 + arr3 ) |
http://rosettacode.org/wiki/Array_concatenation | Array concatenation | Task
Show how to concatenate two arrays in your language.
If this is as simple as array1 + array2, so be it.
| #Futhark | Futhark |
concat as bs cd
|
http://rosettacode.org/wiki/Array_concatenation | Array concatenation | Task
Show how to concatenate two arrays in your language.
If this is as simple as array1 + array2, so be it.
| #FutureBasic | FutureBasic | void local fn DoIt
CFArrayRef array = @[@"Alpha",@"Bravo",@"Charlie"]
print array
array = fn ArrayByAddingObjectsFromArray( array, @[@"Delta",@"Echo",@"FutureBasic"] )
print array
end fn
window 1
fn DoIt
HandleEvents |
http://rosettacode.org/wiki/Array_concatenation | Array concatenation | Task
Show how to concatenate two arrays in your language.
If this is as simple as array1 + array2, so be it.
| #Gambas | Gambas | Public Sub Main()
Dim sString1 As String[] = ["The", "quick", "brown", "fox"]
Dim sString2 As String[] = ["jumped", "over", "the", "lazy", "dog"]
sString1.Insert(sString2)
Print sString1.Join(" ")
End |
http://rosettacode.org/wiki/Array_concatenation | Array concatenation | Task
Show how to concatenate two arrays in your language.
If this is as simple as array1 + array2, so be it.
| #GAP | GAP | # Concatenate arrays
Concatenation([1, 2, 3], [4, 5, 6], [7, 8, 9]);
# [ 1, 2, 3, 4, 5, 6, 7, 8, 9 ]
# Append to a variable
a := [1, 2, 3];
Append(a, [4, 5, 6);
Append(a, [7, 8, 9]);
a;
# [ 1, 2, 3, 4, 5, 6, 7, 8, 9 ] |
http://rosettacode.org/wiki/Array_concatenation | Array concatenation | Task
Show how to concatenate two arrays in your language.
If this is as simple as array1 + array2, so be it.
| #Genie | Genie | [indent=4]
/*
Array concatenation, in Genie
Tectonics: valac array-concat.gs
*/
/* Creates a new array */
def int_array_concat(x:array of int, y:array of int):array of int
var a = new Array of int(false, true, 0) /* (zero-terminated, clear, size) */
a.append_vals (x, x.length)
a.append_vals (y, y.l... |
http://rosettacode.org/wiki/Array_concatenation | Array concatenation | Task
Show how to concatenate two arrays in your language.
If this is as simple as array1 + array2, so be it.
| #GLSL | GLSL |
#define array_concat(T,a1,a2,returned) \
T[a1.length()+a2.length()] returned; \
{ \
for(int i = 0; i < a1.length(); i++){ \
returned[i] = a1[i]; \
} \
for(int i = 0; i < a2.length(); i++){ \
returned[i+a1.length()] = a2[i]; \
} \
}
|
http://rosettacode.org/wiki/Array_concatenation | Array concatenation | Task
Show how to concatenate two arrays in your language.
If this is as simple as array1 + array2, so be it.
| #Go | Go | package main
import "fmt"
func main() {
// Example 1: Idiomatic in Go is use of the append function.
// Elements must be of identical type.
a := []int{1, 2, 3}
b := []int{7, 12, 60} // these are technically slices, not arrays
c := append(a, b...)
fmt.Println(c)
// Example 2: Polymorp... |
http://rosettacode.org/wiki/Array_concatenation | Array concatenation | Task
Show how to concatenate two arrays in your language.
If this is as simple as array1 + array2, so be it.
| #Gosu | Gosu |
var listA = { 1, 2, 3 }
var listB = { 4, 5, 6 }
var listC = listA.concat( listB )
print( listC ) // prints [1, 2, 3, 4, 5, 6]
|
http://rosettacode.org/wiki/Array_concatenation | Array concatenation | Task
Show how to concatenate two arrays in your language.
If this is as simple as array1 + array2, so be it.
| #Groovy | Groovy | def list = [1, 2, 3] + ["Crosby", "Stills", "Nash", "Young"] |
http://rosettacode.org/wiki/Array_concatenation | Array concatenation | Task
Show how to concatenate two arrays in your language.
If this is as simple as array1 + array2, so be it.
| #Haskell | Haskell | (++) :: [a] -> [a] -> [a] |
Dataset Card for the Rosetta Code Dataset
Dataset Summary
Rosetta Code is a programming chrestomathy site. The idea is to present solutions to the same task in as many different languages as possible, to demonstrate how languages are similar and different, and to aid a person with a grounding in one approach to a problem in learning another. Rosetta Code currently has 1,203 tasks, 389 draft tasks, and is aware of 883 languages, though we do not (and cannot) have solutions to every task in every language.
Supported Tasks and Leaderboards
[More Information Needed]
Languages
['ALGOL 68', 'Arturo', 'AWK', 'F#', 'Factor', 'Go', 'J', 'jq', 'Julia', 'Lua', 'Mathematica/Wolfram Language',
'Perl', 'Phix', 'Picat', 'Python', 'Quackery', 'Raku', 'Ring', 'Sidef', 'Vlang', 'Wren', 'XPL0', '11l',
'68000 Assembly', '8th', 'AArch64 Assembly', 'ABAP', 'ACL2', 'Action!', 'ActionScript', 'Ada', 'Aime', 'ALGOL W',
'Amazing Hopper', 'AntLang', 'Apex', 'APL', 'AppleScript', 'ARM Assembly', 'ATS', 'AutoHotkey', 'AutoIt', 'Avail',
'Babel', 'bash', 'BASIC', 'BASIC256', 'BQN', 'Bracmat', 'Burlesque', 'C', 'C#', 'C++', 'Ceylon', 'Clojure', 'COBOL',
'CoffeeScript', 'Common Lisp', 'Component Pascal', 'Crystal', 'D', 'Delphi', 'Dyalect', 'E', 'EasyLang', 'EchoLisp',
'ECL', 'Efene', 'EGL', 'Ela', 'Elena', 'Elixir', 'Elm', 'Emacs Lisp', 'Erlang', 'ERRE', 'Euphoria', 'Fantom', 'FBSL',
'Forth', 'Fortran', 'Free Pascal', 'FreeBASIC', 'Frink', 'FunL', 'Futhark', 'FutureBasic', 'Gambas', 'GAP', 'Genie',
'GLSL', 'Gosu', 'Groovy', 'Haskell', 'HicEst', 'Hy', 'i', 'Icon and Unicon', 'IDL', 'Idris', 'Inform 7', 'Ioke', 'Java',
'JavaScript', 'K', 'Klingphix', 'Klong', 'Kotlin', 'LabVIEW', 'Lambdatalk', 'Lang5', 'langur', 'Lasso', 'LFE', 'Liberty BASIC',
'LIL', 'Limbo', 'Lingo', 'Little', 'Logo', 'M2000 Interpreter', 'Maple', 'Mathcad', 'Mathematica / Wolfram Language',
'MATLAB / Octave', 'Maxima', 'Mercury', 'min', 'MiniScript', 'Nanoquery', 'Neko', 'Nemerle', 'NetRexx', 'NewLISP', 'Nial',
'Nim', 'Oberon-2', 'Objeck', 'Objective-C', 'OCaml', 'Oforth', 'Onyx', 'ooRexx', 'Order', 'OxygenBasic', 'Oz', 'PARI/GP',
'Pascal', 'Phixmonti', 'PHP', 'PicoLisp', 'Pike', 'PL/I', 'Pony', 'PostScript', 'PowerShell', 'Processing', 'Prolog',
'PureBasic', 'Q', 'QBasic', 'QB64', 'R', 'Racket', 'RapidQ', 'REBOL', 'Red', 'ReScript', 'Retro', 'REXX', 'RLaB', 'Ruby',
'Rust', 'S-lang', 'SASL', 'Scala', 'Scheme', 'Seed7', 'SenseTalk', 'SETL', 'Simula', '360 Assembly', '6502 Assembly', 'Slate',
'Smalltalk', 'Ol', 'SNOBOL4', 'Standard ML', 'Stata', 'Swift', 'Tailspin', 'Tcl', 'TI-89 BASIC', 'Trith', 'UNIX Shell',
'Ursa', 'Vala', 'VBA', 'VBScript', 'Visual Basic .NET', 'Wart', 'BaCon', 'Bash', 'Yabasic', 'Yacas', 'Batch File', 'Yorick',
'Z80 Assembly', 'BBC BASIC', 'Brat', 'zkl', 'zonnon', 'Zsh', 'ZX Spectrum Basic', 'Clipper/XBase++', 'ColdFusion', 'Dart',
'DataWeave', 'Dragon', 'FurryScript', 'Fōrmulæ', 'Harbour', 'hexiscript', 'Hoon', 'Janet', '0815', 'Jsish', 'Latitude', 'LiveCode',
'Aikido', 'AmigaE', 'MiniZinc', 'Asymptote', 'NGS', 'bc', 'Befunge', 'Plorth', 'Potion', 'Chef', 'Clipper', 'Relation', 'Robotic',
'dc', 'DCL', 'DWScript', 'Shen', 'SPL', 'SQL', 'Eiffel', 'Symsyn', 'Emojicode', 'TI-83 BASIC', 'Transd', 'Excel', 'Visual Basic',
'FALSE', 'WDTE', 'Fermat', 'XLISP', 'Zig', 'friendly interactive shell', 'Zoea', 'Zoea Visual', 'GEORGE', 'Haxe', 'HolyC', 'LSE64',
'M4', 'MAXScript', 'Metafont', 'МК-61/52', 'ML/I', 'Modula-2', 'Modula-3', 'MUMPS', 'NSIS', 'Openscad', 'Panda', 'PHL', 'Piet',
'Plain English', 'Pop11', 'ProDOS', '8051 Assembly', 'Python 3.x Long Form', 'Raven', 'ALGOL 60', 'Run BASIC', 'Sass/SCSS', 'App Inventor',
'smart BASIC', 'SNUSP', 'Arendelle', 'SSEM', 'Argile', 'Toka', 'TUSCRIPT', '4DOS Batch', '8080 Assembly', 'Vedit macro language',
'8086 Assembly', 'Axe', 'Elisa', 'Verilog', 'Vim Script', 'x86 Assembly', 'Euler Math Toolbox', 'Acurity Architect', 'XSLT', 'BML',
'Agena', 'Boo', 'Brainf***', 'LLVM', 'FOCAL', 'Frege', 'ALGOL-M', 'ChucK', 'Arbre', 'Clean', 'Hare', 'MATLAB', 'Astro', 'Applesoft BASIC',
'OOC', 'Bc', 'Computer/zero Assembly', 'SAS', 'Axiom', 'B', 'Dao', 'Caché ObjectScript', 'CLU', 'Scilab', 'DBL', 'Commodore BASIC', 'Diego',
'Dc', 'BCPL', 'Alore', 'Blade', 'Déjà Vu', 'Octave', 'Cowgol', 'BlitzMax', 'Falcon', 'BlooP', 'SequenceL', 'Sinclair ZX81 BASIC', 'GW-BASIC',
'Lobster', 'C1R', 'Explore', 'Clarion', 'Locomotive Basic', 'GUISS', 'Clio', 'TXR', 'Ursala', 'CLIPS', 'Microsoft Small Basic', 'Golfscript',
'Beads', 'Coco', 'Little Man Computer', 'Chapel', 'Comal', 'Curry', 'GML', 'NewLisp', 'Coq', 'Gastona', 'uBasic/4tH', 'Pyret', 'Dhall',
'Plain TeX', 'Halon', 'Wortel', 'FormulaOne', 'Dafny', 'Ksh', 'Eero', 'Fan', 'Draco', 'DUP', 'Io', 'Metapost', 'Logtalk', 'Dylan', 'TI-83_BASIC',
'Sather', 'Rascal', 'SIMPOL', 'IS-BASIC', 'KonsolScript', 'Pari/Gp', 'Genyris', 'EDSAC order code', 'Egel', 'Joy', 'lang5', 'XProc', 'XQuery',
'POV-Ray', 'Kitten', 'Lisaac', 'LOLCODE', 'SVG', 'MANOOL', 'LSL', 'Moonscript', 'Fhidwfe', 'Inspired by Rascal', 'Fish', 'MIPS Assembly',
'Monte', 'FUZE BASIC', 'NS-HUBASIC', 'Qi', 'GDScript', 'Glee', 'SuperCollider', 'Verbexx', 'Huginn', 'I', 'Informix 4GL', 'Isabelle', 'KQL',
'lambdatalk', 'RPG', 'Lhogho', 'Lily', 'xTalk', 'Scratch', 'Self', 'MAD', 'RATFOR', 'OpenEdge/Progress', 'Xtend', 'Suneido', 'Mirah',
'mIRC Scripting Language', 'ContextFree', 'Tern', 'MMIX', 'AmigaBASIC', 'AurelBasic', 'TorqueScript', 'MontiLang', 'MOO', 'MoonScript',
'Unicon', 'fermat', 'q', 'Myrddin', 'உயிர்/Uyir', 'MySQL', 'newLISP', 'VHDL', 'Oberon', 'Wee Basic', 'OpenEdge ABL/Progress 4GL', 'X86 Assembly',
'XBS', 'KAP', 'Perl5i', 'Peloton', 'PL/M', 'PL/SQL', 'Pointless', 'Polyglot:PL/I and PL/M', 'ToffeeScript', 'TMG', 'TPP', 'Pure', 'Pure Data',
'Xidel', 'S-BASIC', 'Salmon', 'SheerPower 4GL', 'Sparkling', 'Spin', 'SQL PL', 'Transact-SQL', 'True BASIC', 'TSE SAL', 'Tiny BASIC', 'TypeScript',
'Uniface', 'Unison', 'UTFool', 'VAX Assembly', 'VTL-2', 'Wrapl', 'XBasic', 'Xojo', 'XSLT 1.0', 'XSLT 2.0', 'MACRO-10', 'ANSI Standard BASIC',
'UnixPipes', 'REALbasic', 'Golo', 'DM', 'X86-64 Assembly', 'GlovePIE', 'PowerBASIC', 'LotusScript', 'TIScript', 'Kite', 'V', 'Powershell', 'Vorpal',
'Never', 'Set lang', '80386 Assembly', 'Furor', 'Input conversion with Error Handling', 'Guile', 'ASIC', 'Autolisp', 'Agda', 'Swift Playground',
'Nascom BASIC', 'NetLogo', 'CFEngine', 'OASYS Assembler', 'Fennel', 'Object Pascal', 'Shale', 'GFA Basic', 'LDPL', 'Ezhil', 'SMEQL', 'tr', 'WinBatch',
'XPath 2.0', 'Quite BASIC', 'Gema', '6800 Assembly', 'Applescript', 'beeswax', 'gnuplot', 'ECMAScript', 'Snobol4', 'Blast', 'C/C++', 'Whitespace',
'Blue', 'C / C++', 'Apache Derby', 'Lychen', 'Oracle', 'Alternative version', 'PHP+SQLite', 'PILOT', 'PostgreSQL', 'PowerShell+SQLite', 'PureBasic+SQLite',
'Python+SQLite', 'SQLite', 'Tcl+SQLite', 'Transact-SQL (MSSQL)', 'Visual FoxPro', 'SmileBASIC', 'Datalog', 'SystemVerilog', 'Smart BASIC', 'Snobol', 'Terraform',
'ML', 'SQL/PostgreSQL', '4D', 'ArnoldC', 'ANSI BASIC', 'Delphi/Pascal', 'ooREXX', 'Dylan.NET', 'CMake', 'Lucid', 'XProfan', 'sed', 'Gnuplot', 'RPN (HP-15c)',
'Sed', 'JudoScript', 'ScriptBasic', 'Unix shell', 'Niue', 'Powerbuilder', 'C Shell', 'Zoomscript', 'MelonBasic', 'ScratchScript', 'SimpleCode', 'OASYS',
'HTML', 'tbas', 'LaTeX', 'Lilypond', 'MBS', 'B4X', 'Progress', 'SPARK / Ada', 'Arc', 'Icon', 'AutoHotkey_L', 'LSE', 'N/t/roff', 'Fexl', 'Ra', 'Koka',
'Maclisp', 'Mond', 'Nix', 'ZED', 'Inform 6', 'Visual Objects', 'Cind', 'm4', 'g-fu', 'pascal', 'Jinja', 'Mathprog', 'Rhope', 'Delphi and Pascal', 'Epoxy',
'SPARK', 'B4J', 'DIBOL-11', 'JavaFX Script', 'Pixilang', 'BASH (feat. sed & tr)', 'zig', 'Web 68', 'Shiny', 'Egison', 'OS X sha256sum', 'AsciiDots',
'FileMaker', 'Unlambda', 'eC', 'GLBasic', 'JOVIAL', 'haskell', 'Atari BASIC', 'ANTLR', 'Cubescript', 'OoRexx', 'WebAssembly', 'Woma', 'Intercal', 'Malbolge',
'LiveScript', 'Fancy', 'Detailed Description of Programming Task', 'Lean', 'GeneXus', 'CafeOBJ', 'TechBASIC', 'blz', 'MIRC Scripting Language', 'Oxygene',
'zsh', 'Make', 'Whenever', 'Sage', 'L++', 'Tosh', 'LC3 Assembly', 'SETL4', 'Pari/GP', 'OxygenBasic x86 Assembler', 'Pharo', 'Binary Lambda Calculus', 'Bob',
'bootBASIC', 'Turing', 'Ultimate++', 'Gabuzomeu', 'HQ9+', 'INTERCAL', 'Lisp', 'NASM', 'SPWN', 'Turbo Pascal', 'Nickle', 'SPAD', 'Mozart/Oz', 'Batch file',
'SAC', 'C and C++', 'vbscript', 'OPL', 'Wollok', 'Pascal / Delphi / Free Pascal', 'GNU make', 'Recursive', 'C3', 'Picolisp', 'Note 1', 'Note 2', 'Visual Prolog',
'ivy', 'k', 'clojure', 'Unix Shell', 'Basic09', 'S-Basic', 'FreePascal', 'Wolframalpha', 'c_sharp', 'LiveCode Builder', 'Heron', 'SPSS', 'LibreOffice Basic',
'PDP-11 Assembly', 'Solution with recursion', 'Lua/Torch', 'tsql', 'Transact SQL', 'X++', 'Xanadu', 'GDL', 'C_sharp', 'TutorialD', 'Glagol', 'Basic', 'Brace',
'Cixl', 'ELLA', 'Lox', 'Node.js', 'Generic', 'Hope', 'Snap!', 'TSQL', 'MathCortex', 'Mathmap', 'TI-83 BASIC, TI-89 BASIC', 'ZPL', 'LuaTeX', 'AmbientTalk',
'Alternate version to handle 64 and 128 bit integers.', 'Crack', 'Corescript', 'Fortress', 'GB BASIC', 'IWBASIC', 'RPL', 'DMS', 'dodo0', 'MIXAL', 'Occam',
'Morfa', 'Snabel', 'ObjectIcon', 'Panoramic', 'PeopleCode', 'Monicelli', 'gecho', 'Hack', 'JSON', 'Swym', 'ReasonML', 'make', 'TOML', 'WEB', 'SkookumScript',
'Batch', 'TransFORTH', 'Assembly', 'Iterative', 'LC-3', 'Quick Basic/QBASIC/PDS 7.1/VB-DOS', 'Turbo-Basic XL', 'GNU APL', 'OOCalc', 'QUACKASM', 'VB-DOS',
'Typescript', 'x86-64 Assembly', 'FORTRAN', 'Furryscript', 'Gridscript', 'Necromantus', 'HyperTalk', 'Biferno', 'AspectJ', 'SuperTalk', 'Rockstar', 'NMAKE.EXE',
'Opa', 'Algae', 'Anyways', 'Apricot', 'AutoLISP', 'Battlestar', 'Bird', 'Luck', 'Brlcad', 'C++/CLI', 'C2', 'Casio BASIC', 'Cat', 'Cduce', 'Clay', 'Cobra',
'Comefrom0x10', 'Creative Basic', 'Integer BASIC', 'DDNC', 'DeviousYarn', 'DIV Games Studio', 'Wisp', 'AMPL', 'Pare', 'PepsiScript', 'Installing Processing',
'Writing your first program', 'batari Basic', 'Jack', 'elastiC', 'TI-83 Hex Assembly', 'Extended BrainF***', '1C', 'PASM', 'Pict', 'ferite', 'Bori', 'RASEL',
'Echolisp', 'XPath', 'MLite', 'HPPPL', 'Gentee', 'JSE', 'Just Basic', 'Global Script', 'Nyquist', 'HLA', 'Teradata Stored Procedure', 'HTML5', 'Portugol',
'UBASIC', 'NOWUT', 'Inko', 'Jacquard Loom', 'JCL', 'Supernova', 'Small Basic', 'Kabap', 'Kaya', 'Kdf9 Usercode', 'Keg', 'KSI', 'Gecho', 'Gri', 'VBA Excel',
'Luna', 'MACRO-11', 'MINIL', 'Maude', 'MDL', 'Mosaic', 'Purity', 'MUF', 'MyDef', 'MyrtleScript', 'Mythryl', 'Neat', 'ThinBASIC', 'Nit', 'NLP++', 'Odin', 'OpenLisp',
'PDP-1 Assembly', 'Peylang', 'Pikachu', 'NESL', 'PIR', 'Plan', 'Programming Language', 'PROMAL', 'PSQL', 'Quill', 'xEec', 'RED', 'Risc-V', 'RTL/2', 'Sing', 'Sisal',
'SoneKing Assembly', 'SPARC Assembly', 'Swahili', 'Teco', 'Terra', 'TestML', 'Viua VM assembly', 'Whiley', 'Wolfram Language', 'X10', 'Quack', 'K4', 'XL', 'MyHDL',
'JAMES II/Rule-based Cellular Automata', 'APEX', 'QuickBASIC 4.5', 'BrightScript (for Roku)', 'Coconut', 'CSS', 'MapBasic', 'Gleam', 'AdvPL', 'Iptscrae', 'Kamailio Script',
'KL1', 'MEL', 'NATURAL', 'NewtonScript', 'PDP-8 Assembly', 'FRISC Assembly', 'Amstrad CPC Locomotive BASIC', 'Ruby with RSpec', 'php', 'Small', 'Lush', 'Squirrel',
'PL/pgSQL', 'XMIDAS', 'Rebol', 'embedded C for AVR MCU', 'FPr', 'Softbridge BASIC', 'StreamIt', 'jsish', 'JScript.NET', 'MS-DOS', 'Beeswax', 'eSQL', 'QL SuperBASIC',
'Rapira', 'Jq', 'scheme', 'oberon-2', '{{header|Vlang}', 'XUL', 'Soar', 'Befunge 93', 'Bash Shell', 'JacaScript', 'Xfractint', 'JoCaml', 'JotaCode', 'Atari Basic',
'Stretch 1', 'CFScript', 'Stretch 2', 'RPGIV', 'Shell', 'Felix', 'Flex', 'kotlin', 'Deluge', 'ksh', 'OCTAVE', 'vbScript', 'Javascript/NodeJS', 'Coffeescript',
'MS SmallBasic', 'Setl4', 'Overview', '1. Grid structure functions', '2. Calendar data functions', '3. Output configuration', 'WYLBUR', 'Mathematica/ Wolfram Language',
'Commodore Basic', 'Wolfram Language/Mathematica', 'Korn Shell', 'PARIGP', 'Metal', 'VBA (Visual Basic for Application)', 'Lolcode', 'mLite', 'z/Arch Assembler',
"G'MIC", 'C# and Visual Basic .NET', 'Run Basic', 'FP', 'XEmacs Lisp', 'Mathematica//Wolfram Language', 'RPL/2', 'Ya', 'JavaScript + HTML', 'JavaScript + SVG',
'Quick BASIC', 'MatLab', 'Pascal and Object Pascal', 'Apache Ant', 'rust', 'VBA/Visual Basic', 'Go!', 'Lambda Prolog', 'Monkey']
Dataset Structure
Data Instances
First row:
{'task_url': 'http://rosettacode.org/wiki/Ascending_primes',
'task_name': 'Ascending primes',
'task_description': "Generate and show all primes with strictly ascending decimal digits.\n\nAside: Try solving without peeking at existing solutions. I had a weird idea for generating\na prime sieve faster, which needless to say didn't pan out. The solution may be p(r)etty trivial\nbut generating them quickly is at least mildly interesting.\nTip: filtering all 7,027,260 primes below 123,456,789 probably won't kill you, but there is\nat least one significantly better and much faster way, needing a mere 511 odd/prime tests.\n\n\n\nSee also\n OEIS:A052015 - Primes with distinct digits in ascending order\n\n\nRelated\n\nPrimes with digits in nondecreasing order (infinite series allowing duplicate digits, whereas this isn't and doesn't)\nPandigital prime (whereas this is the smallest, with gaps in the used digits being permitted)\n\n",
'language_url': '#ALGOL_68',
'language_name': 'ALGOL 68'}
Code:
BEGIN # find all primes with strictly increasing digits #
PR read "primes.incl.a68" PR # include prime utilities #
PR read "rows.incl.a68" PR # include array utilities #
[ 1 : 512 ]INT primes; # there will be at most 512 (2^9) primes #
INT p count := 0; # number of primes found so far #
FOR d1 FROM 0 TO 1 DO
INT n1 = d1;
FOR d2 FROM 0 TO 1 DO
INT n2 = IF d2 = 1 THEN ( n1 * 10 ) + 2 ELSE n1 FI;
FOR d3 FROM 0 TO 1 DO
INT n3 = IF d3 = 1 THEN ( n2 * 10 ) + 3 ELSE n2 FI;
FOR d4 FROM 0 TO 1 DO
INT n4 = IF d4 = 1 THEN ( n3 * 10 ) + 4 ELSE n3 FI;
FOR d5 FROM 0 TO 1 DO
INT n5 = IF d5 = 1 THEN ( n4 * 10 ) + 5 ELSE n4 FI;
FOR d6 FROM 0 TO 1 DO
INT n6 = IF d6 = 1 THEN ( n5 * 10 ) + 6 ELSE n5 FI;
FOR d7 FROM 0 TO 1 DO
INT n7 = IF d7 = 1 THEN ( n6 * 10 ) + 7 ELSE n6 FI;
FOR d8 FROM 0 TO 1 DO
INT n8 = IF d8 = 1 THEN ( n7 * 10 ) + 8 ELSE n7 FI;
FOR d9 FROM 0 TO 1 DO
INT n9 = IF d9 = 1 THEN ( n8 * 10 ) + 9 ELSE n8 FI;
IF n9 > 0 THEN
IF is probably prime( n9 ) THEN
# have a prime with strictly ascending digits #
primes[ p count +:= 1 ] := n9
FI
FI
OD
OD
OD
OD
OD
OD
OD
OD
OD;
QUICKSORT primes FROMELEMENT 1 TOELEMENT p count; # sort the primes #
FOR i TO p count DO # display the primes #
print( ( " ", whole( primes[ i ], -8 ) ) );
IF i MOD 10 = 0 THEN print( ( newline ) ) FI
OD
END
Data Fields
Dataset({
features: ['task_url', 'task_name', 'task_description', 'language_url', 'language_name', 'code'],
num_rows: 79013
})
Data Splits
The dataset only contains one split, namely the "train" split.
Dataset Creation
Curation Rationale
[More Information Needed]
Source Data
Initial Data Collection and Normalization
[More Information Needed]
Who are the source language producers?
[More Information Needed]
Annotations
Annotation process
[More Information Needed]
Who are the annotators?
[More Information Needed]
Personal and Sensitive Information
[More Information Needed]
Considerations for Using the Data
Social Impact of Dataset
[More Information Needed]
Discussion of Biases
[More Information Needed]
Other Known Limitations
[More Information Needed]
Additional Information
Dataset Curators
[More Information Needed]
Licensing Information
[More Information Needed]
Citation Information
To cite the Rosetta Code webiste you can use the following bibtex entry:
@misc{rosetta-code,
author = "Rosetta Code",
title = "Rosetta Code --- Rosetta Code{,} ",
year = "2022",
url = "https://rosettacode.org/w/index.php?title=Rosetta_Code&oldid=322370",
note = "[Online; accessed 8-December-2022]"
}
Contributions
Thanks to @christopher for adding this dataset.
- Downloads last month
- 379