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/Align_columns
Align columns
Given a text file of many lines, where fields within a line are delineated by a single 'dollar' character, write a program that aligns each column of fields by ensuring that words in each column are separated by at least one space. Further, allow for each word in a column to be either left justified, right justified, o...
#Sidef
Sidef
class Format(text, width) { method align(j) { text.map { |row| row.range.map { |i| '%-*s ' % (width[i], '%*s' % (row[i].len + (width[i]-row[i].len * j/2), row[i])); }.join(""); }.join("\n") + "\n"; } }   func Formatter(text) { var tex...
http://rosettacode.org/wiki/Anagrams
Anagrams
When two or more words are composed of the same characters, but in a different order, they are called anagrams. Task[edit] Using the word list at   http://wiki.puzzlers.org/pub/wordlists/unixdict.txt, find the sets of words that share the same characters that contain the most words in them. Related tasks Word plays ...
#Visual_Basic_.NET
Visual Basic .NET
Imports System.IO Imports System.Collections.ObjectModel   Module Module1   Dim sWords As New Dictionary(Of String, Collection(Of String))   Sub Main()   Dim oStream As StreamReader = Nothing Dim sLines() As String = Nothing Dim sSorted As String = Nothing Dim iHighCount As Integer = 0 Dim iMaxK...
http://rosettacode.org/wiki/Ackermann_function
Ackermann function
The Ackermann function is a classic example of a recursive function, notable especially because it is not a primitive recursive function. It grows very quickly in value, as does the size of its call tree. The Ackermann function is usually defined as follows: A ( m , n ) = { n + 1 if  m = 0 A ( m ...
#Hoon
Hoon
  |= [m=@ud n=@ud] ?: =(m 0) +(n) ?: =(n 0) $(n 1, m (dec m)) $(m (dec m), n $(n (dec n)))  
http://rosettacode.org/wiki/Align_columns
Align columns
Given a text file of many lines, where fields within a line are delineated by a single 'dollar' character, write a program that aligns each column of fields by ensuring that words in each column are separated by at least one space. Further, allow for each word in a column to be either left justified, right justified, o...
#Smalltalk
Smalltalk
text := 'Given$a$text$file$of$many$lines,$where$fields$within$a$line$ are$delineated$by$a$single$''dollar''$character,$write$a$program that$aligns$each$column$of$fields$by$ensuring$that$words$in$each$ column$are$separated$by$at$least$one$space. Further,$allow$for$each$word$in$a$column$to$be$either$left$ justified,$rig...
http://rosettacode.org/wiki/Anagrams
Anagrams
When two or more words are composed of the same characters, but in a different order, they are called anagrams. Task[edit] Using the word list at   http://wiki.puzzlers.org/pub/wordlists/unixdict.txt, find the sets of words that share the same characters that contain the most words in them. Related tasks Word plays ...
#Vlang
Vlang
import os   fn main(){ words := os.read_lines('unixdict.txt')?   mut m := map[string][]string{} mut ma := 0 for word in words { mut letters := word.split('') letters.sort() sorted_word := letters.join('') if sorted_word in m { m[sorted_word] << word } ...
http://rosettacode.org/wiki/Ackermann_function
Ackermann function
The Ackermann function is a classic example of a recursive function, notable especially because it is not a primitive recursive function. It grows very quickly in value, as does the size of its call tree. The Ackermann function is usually defined as follows: A ( m , n ) = { n + 1 if  m = 0 A ( m ...
#Icon_and_Unicon
Icon and Unicon
procedure acker(i, j) static memory   initial { memory := table() every memory[0 to 100] := table() }   if i = 0 then return j + 1   if j = 0 then /memory[i][j] := acker(i - 1, 1) else /memory[i][j] := acker(i - 1, acker(i, j - 1))   return memory[i][j]   end   procedure main() ev...
http://rosettacode.org/wiki/Align_columns
Align columns
Given a text file of many lines, where fields within a line are delineated by a single 'dollar' character, write a program that aligns each column of fields by ensuring that words in each column are separated by at least one space. Further, allow for each word in a column to be either left justified, right justified, o...
#Snobol
Snobol
* Since we don't know how much text we'll be reading in, * we store the words and field widths in tables Words = TABLE() Widths = TABLE()   * Match text from start of string to the first dollar sign WordPat = POS(0) BREAK('$') . Word LE...
http://rosettacode.org/wiki/Anagrams
Anagrams
When two or more words are composed of the same characters, but in a different order, they are called anagrams. Task[edit] Using the word list at   http://wiki.puzzlers.org/pub/wordlists/unixdict.txt, find the sets of words that share the same characters that contain the most words in them. Related tasks Word plays ...
#Wren
Wren
import "io" for File import "/sort" for Sort   var words = File.read("unixdict.txt").split("\n").map { |w| w.trim() } var wordMap = {} for (word in words) { var letters = word.toList Sort.insertion(letters) var sortedWord = letters.join() if (wordMap.containsKey(sortedWord)) { wordMap[sortedWord...
http://rosettacode.org/wiki/Ackermann_function
Ackermann function
The Ackermann function is a classic example of a recursive function, notable especially because it is not a primitive recursive function. It grows very quickly in value, as does the size of its call tree. The Ackermann function is usually defined as follows: A ( m , n ) = { n + 1 if  m = 0 A ( m ...
#Idris
Idris
A : Nat -> Nat -> Nat A Z n = S n A (S m) Z = A m (S Z) A (S m) (S n) = A m (A (S m) n)
http://rosettacode.org/wiki/Align_columns
Align columns
Given a text file of many lines, where fields within a line are delineated by a single 'dollar' character, write a program that aligns each column of fields by ensuring that words in each column are separated by at least one space. Further, allow for each word in a column to be either left justified, right justified, o...
#Standard_ML
Standard ML
fun curry f x y = f (x, y) fun uncurry f (x, y) = f x y   fun maxWidths ([], widths) = widths | maxWidths (strings, []) = map size strings | maxWidths (s :: ss, w :: ws) = Int.max (size s, w) :: maxWidths (ss, ws)   val alignL = uncurry (StringCvt.padRight #" ") and alignR = uncurry (StringCvt.padLeft #" ")   fun a...
http://rosettacode.org/wiki/Anagrams
Anagrams
When two or more words are composed of the same characters, but in a different order, they are called anagrams. Task[edit] Using the word list at   http://wiki.puzzlers.org/pub/wordlists/unixdict.txt, find the sets of words that share the same characters that contain the most words in them. Related tasks Word plays ...
#Yabasic
Yabasic
filename$ = "unixdict.txt" maxw = 0 : c = 0 : dimens(c) i = 0 dim p(100)   if (not open(1,filename$)) error "Could not open '"+filename$+"' for reading"   print "Be patient, please ...\n"   while(not eof(1)) line input #1 a$ c = c + 1 p$(c) = a$ po$(c) = sort$(lower$(a$)) count = 0 head = 0 insert(1) i...
http://rosettacode.org/wiki/Ackermann_function
Ackermann function
The Ackermann function is a classic example of a recursive function, notable especially because it is not a primitive recursive function. It grows very quickly in value, as does the size of its call tree. The Ackermann function is usually defined as follows: A ( m , n ) = { n + 1 if  m = 0 A ( m ...
#Ioke
Ioke
ackermann = method(m,n, cond( m zero?, n succ, n zero?, ackermann(m pred, 1), ackermann(m pred, ackermann(m, n pred))) )
http://rosettacode.org/wiki/Align_columns
Align columns
Given a text file of many lines, where fields within a line are delineated by a single 'dollar' character, write a program that aligns each column of fields by ensuring that words in each column are separated by at least one space. Further, allow for each word in a column to be either left justified, right justified, o...
#Swift
Swift
import Foundation   extension String { func dropLastIf(_ char: Character) -> String { if last == char { return String(dropLast()) } else { return self } } }   enum Align { case left, center, right }   func getLines(input: String) -> [String] { input .components(separatedBy: "\n") ...
http://rosettacode.org/wiki/Anagrams
Anagrams
When two or more words are composed of the same characters, but in a different order, they are called anagrams. Task[edit] Using the word list at   http://wiki.puzzlers.org/pub/wordlists/unixdict.txt, find the sets of words that share the same characters that contain the most words in them. Related tasks Word plays ...
#zkl
zkl
File("unixdict.txt").read(*) // dictionary file to blob, copied from web // blob to dictionary: key is word "fuzzed", values are anagram words .pump(Void,T(fcn(w,d){ key:=w.split("").sort().concat(); // fuzz word to key d.appendV(key,w); // add or append w },d:=Dictionary(0d60_000)));   d.filte...
http://rosettacode.org/wiki/Ackermann_function
Ackermann function
The Ackermann function is a classic example of a recursive function, notable especially because it is not a primitive recursive function. It grows very quickly in value, as does the size of its call tree. The Ackermann function is usually defined as follows: A ( m , n ) = { n + 1 if  m = 0 A ( m ...
#J
J
ack=: c1`c1`c2`c3 @. (#.@,&*) M. c1=: >:@] NB. if 0=x, 1+y c2=: <:@[ ack 1: NB. if 0=y, (x-1) ack 1 c3=: <:@[ ack [ ack <:@] NB. else, (x-1) ack x ack y-1
http://rosettacode.org/wiki/Align_columns
Align columns
Given a text file of many lines, where fields within a line are delineated by a single 'dollar' character, write a program that aligns each column of fields by ensuring that words in each column are separated by at least one space. Further, allow for each word in a column to be either left justified, right justified, o...
#Tcl
Tcl
package require Tcl 8.5   set text {Given$a$text$file$of$many$lines,$where$fields$within$a$line$ are$delineated$by$a$single$'dollar'$character,$write$a$program that$aligns$each$column$of$fields$by$ensuring$that$words$in$each$ column$are$separated$by$at$least$one$space. Further,$allow$for$each$word$in$a$column$to$be$eit...
http://rosettacode.org/wiki/Ackermann_function
Ackermann function
The Ackermann function is a classic example of a recursive function, notable especially because it is not a primitive recursive function. It grows very quickly in value, as does the size of its call tree. The Ackermann function is usually defined as follows: A ( m , n ) = { n + 1 if  m = 0 A ( m ...
#Java
Java
import java.math.BigInteger;   public static BigInteger ack(BigInteger m, BigInteger n) { return m.equals(BigInteger.ZERO) ? n.add(BigInteger.ONE) : ack(m.subtract(BigInteger.ONE), n.equals(BigInteger.ZERO) ? BigInteger.ONE : ack(m, n.subtract(BigInteger.ONE))); }
http://rosettacode.org/wiki/Align_columns
Align columns
Given a text file of many lines, where fields within a line are delineated by a single 'dollar' character, write a program that aligns each column of fields by ensuring that words in each column are separated by at least one space. Further, allow for each word in a column to be either left justified, right justified, o...
#Transd
Transd
#lang transd   MainModule : { txt: "Given$a$text$file$of$many$lines,$where$fields$within$a$line$ are$delineated$by$a$single$'dollar'$character,$write$a$program that$aligns$each$column$of$fields$by$ensuring$that$words$in$each$ column$are$separated$by$at$least$one$space. Further,$allow$for$each$word$in$a$column$to$be$e...
http://rosettacode.org/wiki/Ackermann_function
Ackermann function
The Ackermann function is a classic example of a recursive function, notable especially because it is not a primitive recursive function. It grows very quickly in value, as does the size of its call tree. The Ackermann function is usually defined as follows: A ( m , n ) = { n + 1 if  m = 0 A ( m ...
#JavaScript
JavaScript
function ack(m, n) { return m === 0 ? n + 1 : ack(m - 1, n === 0 ? 1 : ack(m, n - 1)); }
http://rosettacode.org/wiki/Align_columns
Align columns
Given a text file of many lines, where fields within a line are delineated by a single 'dollar' character, write a program that aligns each column of fields by ensuring that words in each column are separated by at least one space. Further, allow for each word in a column to be either left justified, right justified, o...
#TSE_SAL
TSE SAL
  INTEGER PROC FNBlockChangeColumnAlignLeftB( INTEGER columnTotalI, INTEGER spaceTotalI, INTEGER buffer1I ) INTEGER B = FALSE INTEGER downB = TRUE INTEGER minI = 1 INTEGER I = 0 INTEGER J = 0 INTEGER K = 0 INTEGER L = 0 INTEGER buffer2I = 0 STRING s[255] = "" INTEGER wordRightB = FALSE STRING s1[255] = Query...
http://rosettacode.org/wiki/Ackermann_function
Ackermann function
The Ackermann function is a classic example of a recursive function, notable especially because it is not a primitive recursive function. It grows very quickly in value, as does the size of its call tree. The Ackermann function is usually defined as follows: A ( m , n ) = { n + 1 if  m = 0 A ( m ...
#Joy
Joy
DEFINE ack == [ [ [pop null] popd succ ] [ [null] pop pred 1 ack ] [ [dup pred swap] dip pred ack ack ] ] cond.
http://rosettacode.org/wiki/Align_columns
Align columns
Given a text file of many lines, where fields within a line are delineated by a single 'dollar' character, write a program that aligns each column of fields by ensuring that words in each column are separated by at least one space. Further, allow for each word in a column to be either left justified, right justified, o...
#TUSCRIPT
TUSCRIPT
  $$ MODE TUSCRIPT MODE DATA $$ SET exampletext=* Given$a$text$file$of$many$lines,$where$fields$within$a$line$ are$delineated$by$a$single$'dollar'$character,$write$a$program that$aligns$each$column$of$fields$by$ensuring$that$words$in$each$ column$are$separated$by$at$least$one$space. Further,$allow$for$each$word$in$a$co...
http://rosettacode.org/wiki/Ackermann_function
Ackermann function
The Ackermann function is a classic example of a recursive function, notable especially because it is not a primitive recursive function. It grows very quickly in value, as does the size of its call tree. The Ackermann function is usually defined as follows: A ( m , n ) = { n + 1 if  m = 0 A ( m ...
#jq
jq
# input: [m,n] def ack: .[0] as $m | .[1] as $n | if $m == 0 then $n + 1 elif $n == 0 then [$m-1, 1] | ack else [$m-1, ([$m, $n-1 ] | ack)] | ack end ;
http://rosettacode.org/wiki/Align_columns
Align columns
Given a text file of many lines, where fields within a line are delineated by a single 'dollar' character, write a program that aligns each column of fields by ensuring that words in each column are separated by at least one space. Further, allow for each word in a column to be either left justified, right justified, o...
#TXR
TXR
@(collect) @ (coll)@{item /[^$]+/}@(end) @(end) @; nc = number of columns @; pi = padded items (data with row lengths equalized with empty strings) @; cw = vector of max column widths @; ce = center padding @(bind nc @[apply max [mapcar length item]]) @(bind pi @(mapcar (op append @1 (repeat '("") (- nc (length @1))))...
http://rosettacode.org/wiki/Ackermann_function
Ackermann function
The Ackermann function is a classic example of a recursive function, notable especially because it is not a primitive recursive function. It grows very quickly in value, as does the size of its call tree. The Ackermann function is usually defined as follows: A ( m , n ) = { n + 1 if  m = 0 A ( m ...
#Jsish
Jsish
/* Ackermann function, in Jsish */   function ack(m, n) { return m === 0 ? n + 1 : ack(m - 1, n === 0 ? 1 : ack(m, n - 1)); }   if (Interp.conf('unitTest')) { Interp.conf({maxDepth:4096}); ; ack(1,3); ; ack(2,3); ; ack(3,3); ; ack(1,5); ; ack(2,5); ; ack(3,5); }   /* =!EXPECTSTART!= ack(1,3) ==>...
http://rosettacode.org/wiki/Align_columns
Align columns
Given a text file of many lines, where fields within a line are delineated by a single 'dollar' character, write a program that aligns each column of fields by ensuring that words in each column are separated by at least one space. Further, allow for each word in a column to be either left justified, right justified, o...
#UNIX_Shell
UNIX Shell
  cat <<EOF_OUTER > just-nocenter.sh #!/bin/sh   td() { cat <<'EOF' Given$a$text$file$of$many$lines,$where$fields$within$a$line$ are$delineated$by$a$single$'dollar'$character,$write$a$program that$aligns$each$column$of$fields$by$ensuring$that$words$in$each$ column$are$separated$by$at$least$one$space. Further,$allow$for...
http://rosettacode.org/wiki/Ackermann_function
Ackermann function
The Ackermann function is a classic example of a recursive function, notable especially because it is not a primitive recursive function. It grows very quickly in value, as does the size of its call tree. The Ackermann function is usually defined as follows: A ( m , n ) = { n + 1 if  m = 0 A ( m ...
#Julia
Julia
function ack(m,n) if m == 0 return n + 1 elseif n == 0 return ack(m-1,1) else return ack(m-1,ack(m,n-1)) end end
http://rosettacode.org/wiki/Align_columns
Align columns
Given a text file of many lines, where fields within a line are delineated by a single 'dollar' character, write a program that aligns each column of fields by ensuring that words in each column are separated by at least one space. Further, allow for each word in a column to be either left justified, right justified, o...
#Ursala
Ursala
#import std   text =   -[Given$a$text$file$of$many$lines,$where$fields$within$a$line$ are$delineated$by$a$single$'dollar'$character,$write$a$program that$aligns$each$column$of$fields$by$ensuring$that$words$in$each$ column$are$separated$by$at$least$one$space. Further,$allow$for$each$word$in$a$column$to$be$either$left$ ...
http://rosettacode.org/wiki/Ackermann_function
Ackermann function
The Ackermann function is a classic example of a recursive function, notable especially because it is not a primitive recursive function. It grows very quickly in value, as does the size of its call tree. The Ackermann function is usually defined as follows: A ( m , n ) = { n + 1 if  m = 0 A ( m ...
#K
K
ack:{:[0=x;y+1;0=y;_f[x-1;1];_f[x-1;_f[x;y-1]]]} ack[2;2]
http://rosettacode.org/wiki/Align_columns
Align columns
Given a text file of many lines, where fields within a line are delineated by a single 'dollar' character, write a program that aligns each column of fields by ensuring that words in each column are separated by at least one space. Further, allow for each word in a column to be either left justified, right justified, o...
#VBA
VBA
  Public Sub TestSplit(Optional align As String = "left", Optional spacing As Integer = 1) Dim word() As String Dim colwidth() As Integer Dim ncols As Integer Dim lines(6) As String Dim nlines As Integer   'check arguments If Not (align = "left" Or align = "right" Or align = "center") Then MsgBox "Tes...
http://rosettacode.org/wiki/Ackermann_function
Ackermann function
The Ackermann function is a classic example of a recursive function, notable especially because it is not a primitive recursive function. It grows very quickly in value, as does the size of its call tree. The Ackermann function is usually defined as follows: A ( m , n ) = { n + 1 if  m = 0 A ( m ...
#Kdf9_Usercode
Kdf9 Usercode
V6; W0; YS26000; RESTART; J999; J999; PROGRAM; (main program); V1 = B1212121212121212; (radix 10 for FRB); V2 = B2020202020202020; (high bits for decimal digits); V3 = B0741062107230637; ("A[3," in Flexowriter code); V4 = B0727062200250007; ("7] = " in Flexowriter code); V5 = B77777777...
http://rosettacode.org/wiki/Align_columns
Align columns
Given a text file of many lines, where fields within a line are delineated by a single 'dollar' character, write a program that aligns each column of fields by ensuring that words in each column are separated by at least one space. Further, allow for each word in a column to be either left justified, right justified, o...
#VBScript
VBScript
' Align columns - RC - VBScript Const nr=16, nc=16 ReDim d(nc),t(nr), wor(nr,nc) i=i+1: t(i) = "Given$a$text$file$of$many$lines,$where$fields$within$a$line$" i=i+1: t(i) = "are$delineated$by$a$single$'dollar'$character,$write$a$program" i=i+1: t(i) = "that$aligns$each$column$of$fields$by$ensuring$that$words$in$eac...
http://rosettacode.org/wiki/Ackermann_function
Ackermann function
The Ackermann function is a classic example of a recursive function, notable especially because it is not a primitive recursive function. It grows very quickly in value, as does the size of its call tree. The Ackermann function is usually defined as follows: A ( m , n ) = { n + 1 if  m = 0 A ( m ...
#Klingphix
Klingphix
:ack  %n !n %m !m   $m 0 == ( [$n 1 +] [$n 0 == ( [$m 1 - 1 ack] [$m 1 - $m $n 1 - ack ack] ) if ] ) if ;   3 6 ack print nl msec print   " " input
http://rosettacode.org/wiki/Align_columns
Align columns
Given a text file of many lines, where fields within a line are delineated by a single 'dollar' character, write a program that aligns each column of fields by ensuring that words in each column are separated by at least one space. Further, allow for each word in a column to be either left justified, right justified, o...
#Vedit_macro_language
Vedit macro language
RS(10, "$") // Field separator #11 = 1 // Align: 1 = left, 2 = center, 3 = right   // Reset column widths. Max 50 columns for (#1=40; #1<90; #1++) { #@1 = 0 }   // Find max width of each column BOF Repeat(ALL) { for (#1=40; #1<90; #1++) { Match(@10, ADVANCE) // skip field separator if any #2 = Cur_Pos...
http://rosettacode.org/wiki/Ackermann_function
Ackermann function
The Ackermann function is a classic example of a recursive function, notable especially because it is not a primitive recursive function. It grows very quickly in value, as does the size of its call tree. The Ackermann function is usually defined as follows: A ( m , n ) = { n + 1 if  m = 0 A ( m ...
#Klong
Klong
  ack::{:[0=x;y+1:|0=y;.f(x-1;1);.f(x-1;.f(x;y-1))]} ack(2;2)
http://rosettacode.org/wiki/Align_columns
Align columns
Given a text file of many lines, where fields within a line are delineated by a single 'dollar' character, write a program that aligns each column of fields by ensuring that words in each column are separated by at least one space. Further, allow for each word in a column to be either left justified, right justified, o...
#Visual_Basic
Visual Basic
Sub AlignCols(Lines, Optional Align As AlignmentConstants, Optional Sep$ = "$", Optional Sp% = 1) Dim i&, j&, D&, L&, R&: ReDim W(UBound(Lines)): ReDim C&(0)   For j = 0 To UBound(W) W(j) = Split(Lines(j), Sep) If UBound(W(j)) > UBound(C) Then ReDim Preserve C(UBound(W(j))) For i = 0 To UBound(W(j)): If L...
http://rosettacode.org/wiki/Ackermann_function
Ackermann function
The Ackermann function is a classic example of a recursive function, notable especially because it is not a primitive recursive function. It grows very quickly in value, as does the size of its call tree. The Ackermann function is usually defined as follows: A ( m , n ) = { n + 1 if  m = 0 A ( m ...
#Kotlin
Kotlin
  tailrec fun A(m: Long, n: Long): Long { require(m >= 0L) { "m must not be negative" } require(n >= 0L) { "n must not be negative" } if (m == 0L) { return n + 1L } if (n == 0L) { return A(m - 1L, 1L) } return A(m - 1L, A(m, n - 1L)) }   inline fun<T> tryOrNull(block: () -> T...
http://rosettacode.org/wiki/Align_columns
Align columns
Given a text file of many lines, where fields within a line are delineated by a single 'dollar' character, write a program that aligns each column of fields by ensuring that words in each column are separated by at least one space. Further, allow for each word in a column to be either left justified, right justified, o...
#Visual_Basic_.NET
Visual Basic .NET
Module Module1 Private Delegate Function Justification(s As String, width As Integer) As String   Private Function AlignColumns(lines As String(), justification As Justification) As String() Const Separator As Char = "$"c ' build input container table and calculate columns count Dim cont...
http://rosettacode.org/wiki/Ackermann_function
Ackermann function
The Ackermann function is a classic example of a recursive function, notable especially because it is not a primitive recursive function. It grows very quickly in value, as does the size of its call tree. The Ackermann function is usually defined as follows: A ( m , n ) = { n + 1 if  m = 0 A ( m ...
#Lambdatalk
Lambdatalk
  {def ack {lambda {:m :n} {if {= :m 0} then {+ :n 1} else {if {= :n 0} then {ack {- :m 1} 1} else {ack {- :m 1} {ack :m {- :n 1}}}}}}} -> ack   {S.map {ack 0} {S.serie 0 300000}} // 2090ms {S.map {ack 1} {S.serie 0 500}} // 2038ms {S.map {ack 2} {S.serie 0 70}} // 2100ms {S.map {ack 3} {S.seri...
http://rosettacode.org/wiki/Align_columns
Align columns
Given a text file of many lines, where fields within a line are delineated by a single 'dollar' character, write a program that aligns each column of fields by ensuring that words in each column are separated by at least one space. Further, allow for each word in a column to be either left justified, right justified, o...
#Vlang
Vlang
  const text = "Given\$a\$text\$file\$of\$many\$lines,\$where\$fields\$within\$a\$line\$ are\$delineated\$by\$a\$single\$'dollar'\$character,\$write\$a\$program that\$aligns\$each\$column\$of\$fields\$by\$ensuring\$that\$words\$in\$each\$ column\$are\$separated\$by\$at\$least\$one\$space. Further,\$allow\$for\$each\$wo...
http://rosettacode.org/wiki/Ackermann_function
Ackermann function
The Ackermann function is a classic example of a recursive function, notable especially because it is not a primitive recursive function. It grows very quickly in value, as does the size of its call tree. The Ackermann function is usually defined as follows: A ( m , n ) = { n + 1 if  m = 0 A ( m ...
#Lasso
Lasso
#!/usr/bin/lasso9   define ackermann(m::integer, n::integer) => { if(#m == 0) => { return ++#n else(#n == 0) return ackermann(--#m, 1) else return ackermann(#m-1, ackermann(#m, --#n)) } }   with x in generateSeries(1,3), y in generateSeries(0,8,2) do stdoutnl(#x+', '#y+': ' + ackermann(#x, #y))...
http://rosettacode.org/wiki/Align_columns
Align columns
Given a text file of many lines, where fields within a line are delineated by a single 'dollar' character, write a program that aligns each column of fields by ensuring that words in each column are separated by at least one space. Further, allow for each word in a column to be either left justified, right justified, o...
#Wren
Wren
import "io" for File import "/fmt" for Fmt   var LEFT = 0 var RIGHT = 1 var CENTER = 2 var justStrs = ["LEFT", "RIGHT", "CENTER"]   // Gets a list of lines in the file with each line split into fields. var getLines = Fn.new { |fileName| var contents = File.read(fileName) var lines = contents.split("\n") // use ...
http://rosettacode.org/wiki/Ackermann_function
Ackermann function
The Ackermann function is a classic example of a recursive function, notable especially because it is not a primitive recursive function. It grows very quickly in value, as does the size of its call tree. The Ackermann function is usually defined as follows: A ( m , n ) = { n + 1 if  m = 0 A ( m ...
#LFE
LFE
(defun ackermann ((0 n) (+ n 1)) ((m 0) (ackermann (- m 1) 1)) ((m n) (ackermann (- m 1) (ackermann m (- n 1)))))
http://rosettacode.org/wiki/Align_columns
Align columns
Given a text file of many lines, where fields within a line are delineated by a single 'dollar' character, write a program that aligns each column of fields by ensuring that words in each column are separated by at least one space. Further, allow for each word in a column to be either left justified, right justified, o...
#Yabasic
Yabasic
theString$ = "Given$a$text$file$of$many$lines,$where$fields$within$a$line$" theString$ = theString$ + "are$delineated$by$a$single$'dollar'$character,$write$a$program" theString$ = theString$ + "that$aligns$each$column$of$fields$by$ensuring$that$words$in$each$" theString$ = theString$ + "column$are$separated$by$at$least...
http://rosettacode.org/wiki/Ackermann_function
Ackermann function
The Ackermann function is a classic example of a recursive function, notable especially because it is not a primitive recursive function. It grows very quickly in value, as does the size of its call tree. The Ackermann function is usually defined as follows: A ( m , n ) = { n + 1 if  m = 0 A ( m ...
#Liberty_BASIC
Liberty BASIC
Print Ackermann(1, 2)   Function Ackermann(m, n) Select Case Case (m < 0) Or (n < 0) Exit Function Case (m = 0) Ackermann = (n + 1) Case (m > 0) And (n = 0) Ackermann = Ackermann((m - 1), 1) Case (m > 0) And (n >...
http://rosettacode.org/wiki/Align_columns
Align columns
Given a text file of many lines, where fields within a line are delineated by a single 'dollar' character, write a program that aligns each column of fields by ensuring that words in each column are separated by at least one space. Further, allow for each word in a column to be either left justified, right justified, o...
#zkl
zkl
fcn format(text,how){ words:=text.split("$").apply("split").flatten(); max:=words.reduce(fcn(p,n){ n=n.len(); n>p and n or p },0); wordsPerCol:=80/(max+1); fmt:=(switch(how){ case(-1){ "%%-%ds ".fmt(max).fmt } case(0) { fcn(max,w){ a:=(max-w.len())/2; b:=max-w.len() - a; String(" "*a...
http://rosettacode.org/wiki/Ackermann_function
Ackermann function
The Ackermann function is a classic example of a recursive function, notable especially because it is not a primitive recursive function. It grows very quickly in value, as does the size of its call tree. The Ackermann function is usually defined as follows: A ( m , n ) = { n + 1 if  m = 0 A ( m ...
#LiveCode
LiveCode
function ackermann m,n switch Case m = 0 return n + 1 Case (m > 0 And n = 0) return ackermann((m - 1), 1) Case (m > 0 And n > 0) return ackermann((m - 1), ackermann(m, (n - 1))) end switch end ackermann
http://rosettacode.org/wiki/Align_columns
Align columns
Given a text file of many lines, where fields within a line are delineated by a single 'dollar' character, write a program that aligns each column of fields by ensuring that words in each column are separated by at least one space. Further, allow for each word in a column to be either left justified, right justified, o...
#ZX_Spectrum_Basic
ZX Spectrum Basic
5 BORDER 2 10 DATA 6 20 DATA "The$problem$of$Speccy$" 30 DATA "is$the$screen.$" 40 DATA "Need$adapt$text$sample$" 50 DATA "for$show$the$result$" 60 DATA "without$problem$,right?$" 70 DATA "But$see$the$code.$" 80 REM First find the maximum length of a 'word' 90 LET max=0: LET d$="$" 100 READ nlines 110 FOR l=1 TO nline...
http://rosettacode.org/wiki/Ackermann_function
Ackermann function
The Ackermann function is a classic example of a recursive function, notable especially because it is not a primitive recursive function. It grows very quickly in value, as does the size of its call tree. The Ackermann function is usually defined as follows: A ( m , n ) = { n + 1 if  m = 0 A ( m ...
#Logo
Logo
to ack :i :j if :i = 0 [output :j+1] if :j = 0 [output ack :i-1 1] output ack :i-1 ack :i :j-1 end
http://rosettacode.org/wiki/Ackermann_function
Ackermann function
The Ackermann function is a classic example of a recursive function, notable especially because it is not a primitive recursive function. It grows very quickly in value, as does the size of its call tree. The Ackermann function is usually defined as follows: A ( m , n ) = { n + 1 if  m = 0 A ( m ...
#Logtalk
Logtalk
ack(0, N, V) :- !, V is N + 1. ack(M, 0, V) :- !, M2 is M - 1, ack(M2, 1, V). ack(M, N, V) :- M2 is M - 1, N2 is N - 1, ack(M, N2, V2), ack(M2, V2, V).
http://rosettacode.org/wiki/Ackermann_function
Ackermann function
The Ackermann function is a classic example of a recursive function, notable especially because it is not a primitive recursive function. It grows very quickly in value, as does the size of its call tree. The Ackermann function is usually defined as follows: A ( m , n ) = { n + 1 if  m = 0 A ( m ...
#LOLCODE
LOLCODE
HAI 1.3   HOW IZ I ackermann YR m AN YR n NOT m, O RLY? YA RLY, FOUND YR SUM OF n AN 1 OIC   NOT n, O RLY? YA RLY, FOUND YR I IZ ackermann YR DIFF OF m AN 1 AN YR 1 MKAY OIC   FOUND YR I IZ ackermann YR DIFF OF m AN 1 AN YR... I IZ ackermann YR m AN YR DIFF OF n AN 1 MKAY MKAY I...
http://rosettacode.org/wiki/Ackermann_function
Ackermann function
The Ackermann function is a classic example of a recursive function, notable especially because it is not a primitive recursive function. It grows very quickly in value, as does the size of its call tree. The Ackermann function is usually defined as follows: A ( m , n ) = { n + 1 if  m = 0 A ( m ...
#Lua
Lua
function ack(M,N) if M == 0 then return N + 1 end if N == 0 then return ack(M-1,1) end return ack(M-1,ack(M, N-1)) end
http://rosettacode.org/wiki/Ackermann_function
Ackermann function
The Ackermann function is a classic example of a recursive function, notable especially because it is not a primitive recursive function. It grows very quickly in value, as does the size of its call tree. The Ackermann function is usually defined as follows: A ( m , n ) = { n + 1 if  m = 0 A ( m ...
#Lucid
Lucid
ack(m,n) where ack(m,n) = if m eq 0 then n+1 else if n eq 0 then ack(m-1,1) else ack(m-1, ack(m, n-1)) fi fi; end
http://rosettacode.org/wiki/Ackermann_function
Ackermann function
The Ackermann function is a classic example of a recursive function, notable especially because it is not a primitive recursive function. It grows very quickly in value, as does the size of its call tree. The Ackermann function is usually defined as follows: A ( m , n ) = { n + 1 if  m = 0 A ( m ...
#Luck
Luck
function ackermann(m: int, n: int): int = ( if m==0 then n+1 else if n==0 then ackermann(m-1,1) else ackermann(m-1,ackermann(m,n-1)) )
http://rosettacode.org/wiki/Ackermann_function
Ackermann function
The Ackermann function is a classic example of a recursive function, notable especially because it is not a primitive recursive function. It grows very quickly in value, as does the size of its call tree. The Ackermann function is usually defined as follows: A ( m , n ) = { n + 1 if  m = 0 A ( m ...
#M2000_Interpreter
M2000 Interpreter
  Module Checkit { Def ackermann(m,n) =If(m=0-> n+1, If(n=0-> ackermann(m-1,1), ackermann(m-1,ackermann(m,n-1)))) For m = 0 to 3 {For n = 0 to 4 {Print m;" ";n;" ";ackermann(m,n)}} } Checkit     Module Checkit { Module Inner (ack) { For m = 0 to 3 {For n = 0 to 4 {Print m;" ";n;" ";ack(m,n...
http://rosettacode.org/wiki/Ackermann_function
Ackermann function
The Ackermann function is a classic example of a recursive function, notable especially because it is not a primitive recursive function. It grows very quickly in value, as does the size of its call tree. The Ackermann function is usually defined as follows: A ( m , n ) = { n + 1 if  m = 0 A ( m ...
#M4
M4
define(`ack',`ifelse($1,0,`incr($2)',`ifelse($2,0,`ack(decr($1),1)',`ack(decr($1),ack($1,decr($2)))')')')dnl ack(3,3)
http://rosettacode.org/wiki/Ackermann_function
Ackermann function
The Ackermann function is a classic example of a recursive function, notable especially because it is not a primitive recursive function. It grows very quickly in value, as does the size of its call tree. The Ackermann function is usually defined as follows: A ( m , n ) = { n + 1 if  m = 0 A ( m ...
#MAD
MAD
NORMAL MODE IS INTEGER DIMENSION LIST(3000) SET LIST TO LIST   INTERNAL FUNCTION(DUMMY) ENTRY TO ACKH. LOOP WHENEVER M.E.0 FUNCTION RETURN N+1 OR WHENEVER N.E.0 M=M-1 N=1 TRANSF...
http://rosettacode.org/wiki/Ackermann_function
Ackermann function
The Ackermann function is a classic example of a recursive function, notable especially because it is not a primitive recursive function. It grows very quickly in value, as does the size of its call tree. The Ackermann function is usually defined as follows: A ( m , n ) = { n + 1 if  m = 0 A ( m ...
#Maple
Maple
  Ackermann := proc( m :: nonnegint, n :: nonnegint ) option remember; # optional automatic memoization if m = 0 then n + 1 elif n = 0 then thisproc( m - 1, 1 ) else thisproc( m - 1, thisproc( m, n - 1 ) ) end if end proc:  
http://rosettacode.org/wiki/Ackermann_function
Ackermann function
The Ackermann function is a classic example of a recursive function, notable especially because it is not a primitive recursive function. It grows very quickly in value, as does the size of its call tree. The Ackermann function is usually defined as follows: A ( m , n ) = { n + 1 if  m = 0 A ( m ...
#Mathcad
Mathcad
A(m,n):=if(m=0,n+1,if(n=0,A(m-1,1),A(m-1,A(m,n-1))))
http://rosettacode.org/wiki/Ackermann_function
Ackermann function
The Ackermann function is a classic example of a recursive function, notable especially because it is not a primitive recursive function. It grows very quickly in value, as does the size of its call tree. The Ackermann function is usually defined as follows: A ( m , n ) = { n + 1 if  m = 0 A ( m ...
#Mathematica_.2F_Wolfram_Language
Mathematica / Wolfram Language
$RecursionLimit=Infinity Ackermann1[m_,n_]:= If[m==0,n+1, If[ n==0,Ackermann1[m-1,1], Ackermann1[m-1,Ackermann1[m,n-1]] ] ]   Ackermann2[0,n_]:=n+1; Ackermann2[m_,0]:=Ackermann1[m-1,1]; Ackermann2[m_,n_]:=Ackermann1[m-1,Ackermann1[m,n-1]]
http://rosettacode.org/wiki/Ackermann_function
Ackermann function
The Ackermann function is a classic example of a recursive function, notable especially because it is not a primitive recursive function. It grows very quickly in value, as does the size of its call tree. The Ackermann function is usually defined as follows: A ( m , n ) = { n + 1 if  m = 0 A ( m ...
#MATLAB
MATLAB
function A = ackermannFunction(m,n) if m == 0 A = n+1; elseif (m > 0) && (n == 0) A = ackermannFunction(m-1,1); else A = ackermannFunction( m-1,ackermannFunction(m,n-1) ); end end
http://rosettacode.org/wiki/Ackermann_function
Ackermann function
The Ackermann function is a classic example of a recursive function, notable especially because it is not a primitive recursive function. It grows very quickly in value, as does the size of its call tree. The Ackermann function is usually defined as follows: A ( m , n ) = { n + 1 if  m = 0 A ( m ...
#Maxima
Maxima
ackermann(m, n) := if integerp(m) and integerp(n) then ackermann[m, n] else 'ackermann(m, n)$   ackermann[m, n] := if m = 0 then n + 1 elseif m = 1 then 2 + (n + 3) - 3 elseif m = 2 then 2 * (n + 3) - 3 elseif m = 3 then 2^(n + 3) - 3 elseif n ...
http://rosettacode.org/wiki/Ackermann_function
Ackermann function
The Ackermann function is a classic example of a recursive function, notable especially because it is not a primitive recursive function. It grows very quickly in value, as does the size of its call tree. The Ackermann function is usually defined as follows: A ( m , n ) = { n + 1 if  m = 0 A ( m ...
#MAXScript
MAXScript
fn ackermann m n = ( if m == 0 then ( return n + 1 ) else if n == 0 then ( ackermann (m-1) 1 ) else ( ackermann (m-1) (ackermann m (n-1)) ) )
http://rosettacode.org/wiki/Ackermann_function
Ackermann function
The Ackermann function is a classic example of a recursive function, notable especially because it is not a primitive recursive function. It grows very quickly in value, as does the size of its call tree. The Ackermann function is usually defined as follows: A ( m , n ) = { n + 1 if  m = 0 A ( m ...
#Mercury
Mercury
:- func ack(integer, integer) = integer. ack(M, N) = R :- ack(M, N, R).   :- pred ack(integer::in, integer::in, integer::out) is det. ack(M, N, R) :- ( ( M < integer(0)  ; N < integer(0) ) -> throw(bounds_error) ; M = integer(0) -> R = N + integer(1) ; N = integer(0) -> ack(M - integer(1), integer(1), R)...
http://rosettacode.org/wiki/Ackermann_function
Ackermann function
The Ackermann function is a classic example of a recursive function, notable especially because it is not a primitive recursive function. It grows very quickly in value, as does the size of its call tree. The Ackermann function is usually defined as follows: A ( m , n ) = { n + 1 if  m = 0 A ( m ...
#min
min
(  :n :m ( ((m 0 ==) (n 1 +)) ((n 0 ==) (m 1 - 1 ackermann)) ((true) (m 1 - m n 1 - ackermann ackermann)) ) case ) :ackermann
http://rosettacode.org/wiki/Ackermann_function
Ackermann function
The Ackermann function is a classic example of a recursive function, notable especially because it is not a primitive recursive function. It grows very quickly in value, as does the size of its call tree. The Ackermann function is usually defined as follows: A ( m , n ) = { n + 1 if  m = 0 A ( m ...
#MiniScript
MiniScript
ackermann = function(m, n) if m == 0 then return n+1 if n == 0 then return ackermann(m - 1, 1) return ackermann(m - 1, ackermann(m, n - 1)) end function   for m in range(0, 3) for n in range(0, 4) print "(" + m + ", " + n + "): " + ackermann(m, n) end for end for
http://rosettacode.org/wiki/Ackermann_function
Ackermann function
The Ackermann function is a classic example of a recursive function, notable especially because it is not a primitive recursive function. It grows very quickly in value, as does the size of its call tree. The Ackermann function is usually defined as follows: A ( m , n ) = { n + 1 if  m = 0 A ( m ...
#.D0.9C.D0.9A-61.2F52
МК-61/52
П1 <-> П0 ПП 06 С/П ИП0 x=0 13 ИП1 1 + В/О ИП1 x=0 24 ИП0 1 П1 - П0 ПП 06 В/О ИП0 П2 ИП1 1 - П1 ПП 06 П1 ИП2 1 - П0 ПП 06 В/О
http://rosettacode.org/wiki/Ackermann_function
Ackermann function
The Ackermann function is a classic example of a recursive function, notable especially because it is not a primitive recursive function. It grows very quickly in value, as does the size of its call tree. The Ackermann function is usually defined as follows: A ( m , n ) = { n + 1 if  m = 0 A ( m ...
#ML.2FI
ML/I
MCSKIP "WITH" NL "" Ackermann function "" Will overflow when it reaches implementation-defined signed integer limit MCSKIP MT,<> MCINS %. MCDEF ACK WITHS ( , ) AS <MCSET T1=%A1. MCSET T2=%A2. MCGO L1 UNLESS T1 EN 0 %%T2.+1.MCGO L0 %L1.MCGO L2 UNLESS T2 EN 0 ACK(%%T1.-1.,1)MCGO L0 %L2.ACK(%%T1.-1.,ACK(%T1.,%%T2.-1.))> "...
http://rosettacode.org/wiki/Ackermann_function
Ackermann function
The Ackermann function is a classic example of a recursive function, notable especially because it is not a primitive recursive function. It grows very quickly in value, as does the size of its call tree. The Ackermann function is usually defined as follows: A ( m , n ) = { n + 1 if  m = 0 A ( m ...
#mLite
mLite
fun ackermann( 0, n ) = n + 1 | ( m, 0 ) = ackermann( m - 1, 1 ) | ( m, n ) = ackermann( m - 1, ackermann(m, n - 1) )
http://rosettacode.org/wiki/Ackermann_function
Ackermann function
The Ackermann function is a classic example of a recursive function, notable especially because it is not a primitive recursive function. It grows very quickly in value, as does the size of its call tree. The Ackermann function is usually defined as follows: A ( m , n ) = { n + 1 if  m = 0 A ( m ...
#Modula-2
Modula-2
MODULE ackerman;   IMPORT ASCII, NumConv, InOut;   VAR m, n : LONGCARD; string : ARRAY [0..19] OF CHAR; OK : BOOLEAN;   PROCEDURE Ackerman (x, y : LONGCARD) : LONGCARD;   BEGIN IF x = 0 THEN RETURN y + 1 ELSIF y = 0 THEN RETURN Ackerman (x - 1 , 1) ...
http://rosettacode.org/wiki/Abbreviations,_simple
Abbreviations, simple
The use of   abbreviations   (also sometimes called synonyms, nicknames, AKAs, or aliases)   can be an easy way to add flexibility when specifying or using commands, sub─commands, options, etc. For this task, the following   command table   will be used: add 1 alter 3 backup 2 bottom 1 Cappend 2 change 1 ...
#11l
11l
V command_table_text = |‘add 1 alter 3 backup 2 bottom 1 Cappend 2 change 1 Schange Cinsert 2 Clast 3 compress 4 copy 2 count 3 Coverlay 3 cursor 3 delete 3 Cdelete 2 down 1 duplicate 3 xEdit 1 expand 3 extract 3 find 1 Nfind 2 Nfindup 6 NfUP 3 Cfind 2 findUP 3 fUP 2 forward 2 get help 1 hexType 4 ...
http://rosettacode.org/wiki/Ackermann_function
Ackermann function
The Ackermann function is a classic example of a recursive function, notable especially because it is not a primitive recursive function. It grows very quickly in value, as does the size of its call tree. The Ackermann function is usually defined as follows: A ( m , n ) = { n + 1 if  m = 0 A ( m ...
#Modula-3
Modula-3
MODULE Ack EXPORTS Main;   FROM IO IMPORT Put; FROM Fmt IMPORT Int;   PROCEDURE Ackermann(m, n: CARDINAL): CARDINAL = BEGIN IF m = 0 THEN RETURN n + 1; ELSIF n = 0 THEN RETURN Ackermann(m - 1, 1); ELSE RETURN Ackermann(m - 1, Ackermann(m, n - 1)); END; END Ackermann;   BEGIN FOR...
http://rosettacode.org/wiki/Abbreviations,_simple
Abbreviations, simple
The use of   abbreviations   (also sometimes called synonyms, nicknames, AKAs, or aliases)   can be an easy way to add flexibility when specifying or using commands, sub─commands, options, etc. For this task, the following   command table   will be used: add 1 alter 3 backup 2 bottom 1 Cappend 2 change 1 ...
#AArch64_Assembly
AArch64 Assembly
  /* ARM assembly AARCH64 Raspberry PI 3B */ /* program abbrSimple64.s */ /* store list of command in a file commandSimple.txt */ /* and run the program abbrSimple64 commandSimple.txt */   /*******************************************/ /* Constantes file */ /**********************************...
http://rosettacode.org/wiki/Ackermann_function
Ackermann function
The Ackermann function is a classic example of a recursive function, notable especially because it is not a primitive recursive function. It grows very quickly in value, as does the size of its call tree. The Ackermann function is usually defined as follows: A ( m , n ) = { n + 1 if  m = 0 A ( m ...
#MUMPS
MUMPS
Ackermann(m,n) ; If m=0 Quit n+1 If m>0,n=0 Quit $$Ackermann(m-1,1) If m>0,n>0 Quit $$Ackermann(m-1,$$Ackermann(m,n-1)) Set $Ecode=",U13-Invalid parameter for Ackermann: m="_m_", n="_n_","   Write $$Ackermann(1,8) ; 10 Write $$Ackermann(2,8) ; 19 Write $$Ackermann(3,5) ; 253
http://rosettacode.org/wiki/Abelian_sandpile_model
Abelian sandpile model
This page uses content from Wikipedia. The original article was at Abelian sandpile model. The list of authors can be seen in the page history. As with Rosetta Code, the text of Wikipedia is available under the GNU FDL. (See links for details on variance) Implement the Abelian sandpile model also known as Bak–Tan...
#11l
11l
V grid = [[0] * 10] * 10 grid[5][5] = 64   print(‘Before:’) L(row) grid print(row.map(c -> ‘#3’.format(c)).join(‘’))   F simulate(&grid) L V changed = 0B L(arr) grid V ii = L.index L(val) arr V jj = L.index I val > 3 grid[ii][jj] -= 4 ...
http://rosettacode.org/wiki/Abbreviations,_simple
Abbreviations, simple
The use of   abbreviations   (also sometimes called synonyms, nicknames, AKAs, or aliases)   can be an easy way to add flexibility when specifying or using commands, sub─commands, options, etc. For this task, the following   command table   will be used: add 1 alter 3 backup 2 bottom 1 Cappend 2 change 1 ...
#Ada
Ada
with Ada.Characters.Handling; with Ada.Containers.Vectors; with Ada.Strings.Fixed; with Ada.Strings.Maps.Constants; with Ada.Strings.Unbounded; with Ada.Text_IO;   procedure Abbreviations_Simple is   use Ada.Strings.Unbounded; subtype Ustring is Unbounded_String;   type Word_Entry is record Word : Ustrin...
http://rosettacode.org/wiki/Abbreviations,_easy
Abbreviations, easy
This task is an easier (to code) variant of the Rosetta Code task:   Abbreviations, simple. For this task, the following   command table   will be used: Add ALTer BAckup Bottom CAppend Change SCHANGE CInsert CLAst COMPress COpy COUnt COVerlay CURsor DELete CDelete Down DUPlicate Xedit EXPand EXTract Find ...
#11l
11l
V command_table_text = |‘Add ALTer BAckup Bottom CAppend Change SCHANGE CInsert CLAst COMPress COpy COUnt COVerlay CURsor DELete CDelete Down DUPlicate Xedit EXPand EXTract Find NFind NFINDUp NFUp CFind FINdup FUp FOrward GET Help HEXType Input POWerinput Join SPlit SPLTJOIN LOAD Locate CLocate LOWercase UP...
http://rosettacode.org/wiki/Ackermann_function
Ackermann function
The Ackermann function is a classic example of a recursive function, notable especially because it is not a primitive recursive function. It grows very quickly in value, as does the size of its call tree. The Ackermann function is usually defined as follows: A ( m , n ) = { n + 1 if  m = 0 A ( m ...
#Neko
Neko
/** Ackermann recursion, in Neko Tectonics: nekoc ackermann.neko neko ackermann 4 0 */ ack = function(x,y) { if (x == 0) return y+1; if (y == 0) return ack(x-1,1); return ack(x-1, ack(x,y-1)); };   var arg1 = $int($loader.args[0]); var arg2 = $int($loader.args[1]);   /* If not given, or negative, def...
http://rosettacode.org/wiki/Abelian_sandpile_model
Abelian sandpile model
This page uses content from Wikipedia. The original article was at Abelian sandpile model. The list of authors can be seen in the page history. As with Rosetta Code, the text of Wikipedia is available under the GNU FDL. (See links for details on variance) Implement the Abelian sandpile model also known as Bak–Tan...
#AArch64_Assembly
AArch64 Assembly
  /* ARM assembly AARCH64 Raspberry PI 3B or android 64 bits */ /* program abelian64.s */   /* run : abelian 256 12 12 */   /*******************************************/ /* Constantes file */ /*******************************************/ /* for this file see task include a file in language ...
http://rosettacode.org/wiki/Abelian_sandpile_model
Abelian sandpile model
This page uses content from Wikipedia. The original article was at Abelian sandpile model. The list of authors can be seen in the page history. As with Rosetta Code, the text of Wikipedia is available under the GNU FDL. (See links for details on variance) Implement the Abelian sandpile model also known as Bak–Tan...
#ARM_Assembly
ARM Assembly
  /* ARM assembly Raspberry PI or android 32 bits */ /* program abelian.s */   /* run : abelian 256 12 12 */   /* REMARK 1 : this program use routines in a include file see task Include a file language arm assembly for the routine affichageMess conversion10 see at end of this program the instruction i...
http://rosettacode.org/wiki/Abbreviations,_simple
Abbreviations, simple
The use of   abbreviations   (also sometimes called synonyms, nicknames, AKAs, or aliases)   can be an easy way to add flexibility when specifying or using commands, sub─commands, options, etc. For this task, the following   command table   will be used: add 1 alter 3 backup 2 bottom 1 Cappend 2 change 1 ...
#ALGOL_68
ALGOL 68
# "Simple" abbreviations #   # returns the next word from text, updating pos # PRIO NEXTWORD = 1; OP NEXTWORD = ( REF INT pos, STRING text )STRING: BEGIN # skip spaces # WHILE IF pos > UPB text THEN FALSE ELSE text[ pos ] = " " ...
http://rosettacode.org/wiki/Abbreviations,_easy
Abbreviations, easy
This task is an easier (to code) variant of the Rosetta Code task:   Abbreviations, simple. For this task, the following   command table   will be used: Add ALTer BAckup Bottom CAppend Change SCHANGE CInsert CLAst COMPress COpy COUnt COVerlay CURsor DELete CDelete Down DUPlicate Xedit EXPand EXTract Find ...
#AArch64_Assembly
AArch64 Assembly
  /* ARM assembly AARCH64 Raspberry PI 3B */ /* program abbrEasy64.s */ /* store list of command in a file */ /* and run the program abbrEasy64 command.file */   /*******************************************/ /* Constantes file */ /*******************************************/ /* for this file...
http://rosettacode.org/wiki/Abbreviations,_easy
Abbreviations, easy
This task is an easier (to code) variant of the Rosetta Code task:   Abbreviations, simple. For this task, the following   command table   will be used: Add ALTer BAckup Bottom CAppend Change SCHANGE CInsert CLAst COMPress COpy COUnt COVerlay CURsor DELete CDelete Down DUPlicate Xedit EXPand EXTract Find ...
#Ada
Ada
with Ada.Characters.Handling; with Ada.Containers.Indefinite_Vectors; with Ada.Strings.Fixed; with Ada.Strings.Maps.Constants; with Ada.Text_IO;   procedure Abbreviations_Easy is   package Command_Vectors is new Ada.Containers.Indefinite_Vectors (Index_Type => Positive, ...
http://rosettacode.org/wiki/Ackermann_function
Ackermann function
The Ackermann function is a classic example of a recursive function, notable especially because it is not a primitive recursive function. It grows very quickly in value, as does the size of its call tree. The Ackermann function is usually defined as follows: A ( m , n ) = { n + 1 if  m = 0 A ( m ...
#Nemerle
Nemerle
  using System; using Nemerle.IO;     def ackermann(m, n) { def A = ackermann; match(m, n) { | (0, n) => n + 1 | (m, 0) when m > 0 => A(m - 1, 1) | (m, n) when m > 0 && n > 0 => A(m - 1, A(m, n - 1)) | _ => throw Exception("invalid inputs"); } }     for(mutable m = 0; m < 4; ...
http://rosettacode.org/wiki/Abelian_sandpile_model
Abelian sandpile model
This page uses content from Wikipedia. The original article was at Abelian sandpile model. The list of authors can be seen in the page history. As with Rosetta Code, the text of Wikipedia is available under the GNU FDL. (See links for details on variance) Implement the Abelian sandpile model also known as Bak–Tan...
#C
C
  #include<stdlib.h> #include<string.h> #include<stdio.h>   int main(int argc, char** argv) { int i,j,sandPileEdge, centerPileHeight, processAgain = 1,top,down,left,right; int** sandPile; char* fileName; static unsigned char colour[3];   if(argc!=3){ printf("Usage: %s <Sand pile side> <Center pile height>",argv...
http://rosettacode.org/wiki/Abbreviations,_simple
Abbreviations, simple
The use of   abbreviations   (also sometimes called synonyms, nicknames, AKAs, or aliases)   can be an easy way to add flexibility when specifying or using commands, sub─commands, options, etc. For this task, the following   command table   will be used: add 1 alter 3 backup 2 bottom 1 Cappend 2 change 1 ...
#ARM_Assembly
ARM Assembly
Ok correction le 17/11/2020 16H
http://rosettacode.org/wiki/Abbreviations,_easy
Abbreviations, easy
This task is an easier (to code) variant of the Rosetta Code task:   Abbreviations, simple. For this task, the following   command table   will be used: Add ALTer BAckup Bottom CAppend Change SCHANGE CInsert CLAst COMPress COpy COUnt COVerlay CURsor DELete CDelete Down DUPlicate Xedit EXPand EXTract Find ...
#ALGOL_68
ALGOL 68
# "Easy" abbreviations # # table of "commands" - upper-case indicates the mminimum abbreviation # STRING command table = "Add ALTer BAckup Bottom CAppend Change SCHANGE CInsert CLAst COMPress COpy " + "COUnt COVerlay CURsor DELete CDelete Down DUPl...
http://rosettacode.org/wiki/Ackermann_function
Ackermann function
The Ackermann function is a classic example of a recursive function, notable especially because it is not a primitive recursive function. It grows very quickly in value, as does the size of its call tree. The Ackermann function is usually defined as follows: A ( m , n ) = { n + 1 if  m = 0 A ( m ...
#NetRexx
NetRexx
/* NetRexx */ options replace format comments java crossref symbols binary   numeric digits 66   parse arg j_ k_ . if j_ = '' | j_ = '.' | \j_.datatype('w') then j_ = 3 if k_ = '' | k_ = '.' | \k_.datatype('w') then k_ = 5   loop m_ = 0 to j_ say loop n_ = 0 to k_ say 'ackermann('m_','n_') =' ackermann(m_, n_)....
http://rosettacode.org/wiki/Abelian_sandpile_model
Abelian sandpile model
This page uses content from Wikipedia. The original article was at Abelian sandpile model. The list of authors can be seen in the page history. As with Rosetta Code, the text of Wikipedia is available under the GNU FDL. (See links for details on variance) Implement the Abelian sandpile model also known as Bak–Tan...
#C.2B.2B
C++
#include <iostream> #include "xtensor/xarray.hpp" #include "xtensor/xio.hpp" #include "xtensor-io/ximage.hpp"   xt::xarray<int> init_grid (unsigned long x_dim, unsigned long y_dim) { xt::xarray<int>::shape_type shape = { x_dim, y_dim }; xt::xarray<int> grid(shape);   grid(x_dim/2, y_dim/2) = 64000;   re...
http://rosettacode.org/wiki/Abbreviations,_simple
Abbreviations, simple
The use of   abbreviations   (also sometimes called synonyms, nicknames, AKAs, or aliases)   can be an easy way to add flexibility when specifying or using commands, sub─commands, options, etc. For this task, the following   command table   will be used: add 1 alter 3 backup 2 bottom 1 Cappend 2 change 1 ...
#C
C
#include <ctype.h> #include <stdbool.h> #include <stdio.h> #include <stdlib.h> #include <string.h>   const char* command_table = "add 1 alter 3 backup 2 bottom 1 Cappend 2 change 1 Schange Cinsert 2 Clast 3 " "compress 4 copy 2 count 3 Coverlay 3 cursor 3 delete 3 Cdelete 2 down 1 duplicate " "3 xEdit ...
http://rosettacode.org/wiki/Abbreviations,_easy
Abbreviations, easy
This task is an easier (to code) variant of the Rosetta Code task:   Abbreviations, simple. For this task, the following   command table   will be used: Add ALTer BAckup Bottom CAppend Change SCHANGE CInsert CLAst COMPress COpy COUnt COVerlay CURsor DELete CDelete Down DUPlicate Xedit EXPand EXTract Find ...
#ARM_Assembly
ARM Assembly
Correction program 15/11/2020
http://rosettacode.org/wiki/Abbreviations,_easy
Abbreviations, easy
This task is an easier (to code) variant of the Rosetta Code task:   Abbreviations, simple. For this task, the following   command table   will be used: Add ALTer BAckup Bottom CAppend Change SCHANGE CInsert CLAst COMPress COpy COUnt COVerlay CURsor DELete CDelete Down DUPlicate Xedit EXPand EXTract Find ...
#AutoHotkey
AutoHotkey
; Setting up command table as one string str = ( Add ALTer BAckup Bottom CAppend Change SCHANGE CInsert CLAst COMPress COpy COUnt COVerlay CURsor DELete CDelete Down DUPlicate Xedit EXPand EXTract Find NFind NFINDUp NFUp CFind FINdup FUp FOrward GET Help HEXType Input POWerinput Join SPlit SPLTJOIN LOAD Locate...
http://rosettacode.org/wiki/Abelian_sandpile_model/Identity
Abelian sandpile model/Identity
Our sandpiles are based on a 3 by 3 rectangular grid giving nine areas that contain a number from 0 to 3 inclusive. (The numbers are said to represent grains of sand in each area of the sandpile). E.g. s1 = 1 2 0 2 1 1 0 1 3 and s2 = 2 1 3 1 0 1 0 1 0 Addition on sandpiles is done by a...
#11l
11l
T Sandpile DefaultDict[(Int, Int), Int] grid   F (gridtext) V array = gridtext.split_py().map(x -> Int(x)) L(x) array .grid[(L.index I/ 3, L.index % 3)] = x   Set[(Int, Int)] _border = Set(cart_product(-1 .< 4, -1 .< 4).filter((r, c) -> !(r C 0..2) | !(c C 0..2))) _cell_coords = cart_pr...
http://rosettacode.org/wiki/Abstract_type
Abstract type
Abstract type is a type without instances or without definition. For example in object-oriented programming using some languages, abstract types can be partial implementations of other types, which are to be derived there-from. An abstract type may provide implementation of some operations and/or components. Abstract ...
#11l
11l
T AbstractQueue F.virtual.abstract enqueue(Int item) -> N   T PrintQueue(AbstractQueue) F.virtual.assign enqueue(Int item) -> N print(item)
http://rosettacode.org/wiki/Ackermann_function
Ackermann function
The Ackermann function is a classic example of a recursive function, notable especially because it is not a primitive recursive function. It grows very quickly in value, as does the size of its call tree. The Ackermann function is usually defined as follows: A ( m , n ) = { n + 1 if  m = 0 A ( m ...
#NewLISP
NewLISP
  #! /usr/local/bin/newlisp   (define (ackermann m n) (cond ((zero? m) (inc n)) ((zero? n) (ackermann (dec m) 1)) (true (ackermann (- m 1) (ackermann m (dec n))))))  
http://rosettacode.org/wiki/Abelian_sandpile_model
Abelian sandpile model
This page uses content from Wikipedia. The original article was at Abelian sandpile model. The list of authors can be seen in the page history. As with Rosetta Code, the text of Wikipedia is available under the GNU FDL. (See links for details on variance) Implement the Abelian sandpile model also known as Bak–Tan...
#Delphi
Delphi
  program Abelian_sandpile_model;   {$APPTYPE CONSOLE}   {$R *.res}   uses System.SysUtils, Vcl.Graphics, System.Classes;   type TGrid = array of array of Integer;   function Iterate(var Grid: TGrid): Boolean; var changed: Boolean; i: Integer; j: Integer; val: Integer; Alength: Integer; begin Alengt...
http://rosettacode.org/wiki/Abbreviations,_simple
Abbreviations, simple
The use of   abbreviations   (also sometimes called synonyms, nicknames, AKAs, or aliases)   can be an easy way to add flexibility when specifying or using commands, sub─commands, options, etc. For this task, the following   command table   will be used: add 1 alter 3 backup 2 bottom 1 Cappend 2 change 1 ...
#C.2B.2B
C++
#include <algorithm> #include <cctype> #include <iostream> #include <sstream> #include <string> #include <vector>   const char* command_table = "add 1 alter 3 backup 2 bottom 1 Cappend 2 change 1 Schange Cinsert 2 Clast 3 " "compress 4 copy 2 count 3 Coverlay 3 cursor 3 delete 3 Cdelete 2 down 1 duplicat...
http://rosettacode.org/wiki/Abbreviations,_easy
Abbreviations, easy
This task is an easier (to code) variant of the Rosetta Code task:   Abbreviations, simple. For this task, the following   command table   will be used: Add ALTer BAckup Bottom CAppend Change SCHANGE CInsert CLAst COMPress COpy COUnt COVerlay CURsor DELete CDelete Down DUPlicate Xedit EXPand EXTract Find ...
#AWK
AWK
#!/usr/bin/awk -f BEGIN { FS=" "; split(" Add ALTer BAckup Bottom CAppend Change SCHANGE CInsert CLAst COMPress COpy" \ " COUnt COVerlay CURsor DELete CDelete Down DUPlicate Xedit EXPand EXTract Find" \ " NFind NFINDUp NFUp CFind FINdup FUp FOrward GET Help HEXType Input POWerinput" \ " Joi...
http://rosettacode.org/wiki/Abelian_sandpile_model/Identity
Abelian sandpile model/Identity
Our sandpiles are based on a 3 by 3 rectangular grid giving nine areas that contain a number from 0 to 3 inclusive. (The numbers are said to represent grains of sand in each area of the sandpile). E.g. s1 = 1 2 0 2 1 1 0 1 3 and s2 = 2 1 3 1 0 1 0 1 0 Addition on sandpiles is done by a...
#AArch64_Assembly
AArch64 Assembly
  /* ARM assembly AARCH64 Raspberry PI 3B or android 64 bits */ /* program abelianSum64.s */   /*******************************************/ /* Constantes file */ /*******************************************/ /* for this file see task include a file in language AArch64 assembly*/ .include "....
http://rosettacode.org/wiki/Abstract_type
Abstract type
Abstract type is a type without instances or without definition. For example in object-oriented programming using some languages, abstract types can be partial implementations of other types, which are to be derived there-from. An abstract type may provide implementation of some operations and/or components. Abstract ...
#AArch64_Assembly
AArch64 Assembly
class abs definition abstract. public section. methods method1 abstract importing iv_value type f exporting ev_ret type i. protected section. methods method2 abstract importing iv_name type string exporting ev_ret type i. methods add importing iv_a type i iv_b type i exporting ev_ret type i. endclass.  ...