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/Character_codes
Character codes
Task Given a character value in your language, print its code   (could be ASCII code, Unicode code, or whatever your language uses). Example The character   'a'   (lowercase letter A)   has a code of 97 in ASCII   (as well as Unicode, as ASCII forms the beginning of Unicode). Conversely, given a code, print out...
#SPL
SPL
x = #.array("a") #.output("a -> ",x[1]," ",x[2]) x = [98,0] #.output("98 0 -> ",#.str(x))
http://rosettacode.org/wiki/Character_codes
Character codes
Task Given a character value in your language, print its code   (could be ASCII code, Unicode code, or whatever your language uses). Example The character   'a'   (lowercase letter A)   has a code of 97 in ASCII   (as well as Unicode, as ASCII forms the beginning of Unicode). Conversely, given a code, print out...
#Standard_ML
Standard ML
print (Int.toString (ord #"a") ^ "\n"); (* prints "97" *) print (Char.toString (chr 97) ^ "\n"); (* prints "a" *)
http://rosettacode.org/wiki/Character_codes
Character codes
Task Given a character value in your language, print its code   (could be ASCII code, Unicode code, or whatever your language uses). Example The character   'a'   (lowercase letter A)   has a code of 97 in ASCII   (as well as Unicode, as ASCII forms the beginning of Unicode). Conversely, given a code, print out...
#Stata
Stata
: ascii("α") 1 2 +-------------+ 1 | 206 177 | +-------------+
http://rosettacode.org/wiki/Character_codes
Character codes
Task Given a character value in your language, print its code   (could be ASCII code, Unicode code, or whatever your language uses). Example The character   'a'   (lowercase letter A)   has a code of 97 in ASCII   (as well as Unicode, as ASCII forms the beginning of Unicode). Conversely, given a code, print out...
#Swift
Swift
let c1: UnicodeScalar = "a" println(c1.value) // prints "97" let c2: UnicodeScalar = "π" println(c2.value) // prints "960"
http://rosettacode.org/wiki/Character_codes
Character codes
Task Given a character value in your language, print its code   (could be ASCII code, Unicode code, or whatever your language uses). Example The character   'a'   (lowercase letter A)   has a code of 97 in ASCII   (as well as Unicode, as ASCII forms the beginning of Unicode). Conversely, given a code, print out...
#Tailspin
Tailspin
  'abc' -> $::asCodePoints -> !OUT::write '$#10;' -> !OUT::write '$#97;' -> !OUT::write  
http://rosettacode.org/wiki/Character_codes
Character codes
Task Given a character value in your language, print its code   (could be ASCII code, Unicode code, or whatever your language uses). Example The character   'a'   (lowercase letter A)   has a code of 97 in ASCII   (as well as Unicode, as ASCII forms the beginning of Unicode). Conversely, given a code, print out...
#Tcl
Tcl
# ASCII puts [scan "a" %c] ;# ==> 97 puts [format %c 97] ;# ==> a # Unicode is the same puts [scan "π" %c] ;# ==> 960 puts [format %c 960] ;# ==> π
http://rosettacode.org/wiki/Character_codes
Character codes
Task Given a character value in your language, print its code   (could be ASCII code, Unicode code, or whatever your language uses). Example The character   'a'   (lowercase letter A)   has a code of 97 in ASCII   (as well as Unicode, as ASCII forms the beginning of Unicode). Conversely, given a code, print out...
#TI-83_BASIC
TI-83 BASIC
"ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789→Str1 Disp inString(Str1,"A Input "CODE? ",A Disp sub(Str1,A,1
http://rosettacode.org/wiki/Character_codes
Character codes
Task Given a character value in your language, print its code   (could be ASCII code, Unicode code, or whatever your language uses). Example The character   'a'   (lowercase letter A)   has a code of 97 in ASCII   (as well as Unicode, as ASCII forms the beginning of Unicode). Conversely, given a code, print out...
#TI-89_BASIC
TI-89 BASIC
Prgm Local k, s ClrIO Loop Disp "Press a key, or ON to exit." getKey() © clear buffer 0 → k : While k = 0 : getKey() → k : EndWhile ClrIO If k ≥ 256 Then Disp "Not a character." Disp "Code: " & string(k) Else   char(k) → s © © char() and or...
http://rosettacode.org/wiki/Character_codes
Character codes
Task Given a character value in your language, print its code   (could be ASCII code, Unicode code, or whatever your language uses). Example The character   'a'   (lowercase letter A)   has a code of 97 in ASCII   (as well as Unicode, as ASCII forms the beginning of Unicode). Conversely, given a code, print out...
#Trith
Trith
"a" ord print 97 chr print
http://rosettacode.org/wiki/Character_codes
Character codes
Task Given a character value in your language, print its code   (could be ASCII code, Unicode code, or whatever your language uses). Example The character   'a'   (lowercase letter A)   has a code of 97 in ASCII   (as well as Unicode, as ASCII forms the beginning of Unicode). Conversely, given a code, print out...
#TUSCRIPT
TUSCRIPT
$$ MODE TUSCRIPT SET character ="a", code=DECODE (character,byte) PRINT character,"=",code
http://rosettacode.org/wiki/Character_codes
Character codes
Task Given a character value in your language, print its code   (could be ASCII code, Unicode code, or whatever your language uses). Example The character   'a'   (lowercase letter A)   has a code of 97 in ASCII   (as well as Unicode, as ASCII forms the beginning of Unicode). Conversely, given a code, print out...
#uBasic.2F4tH
uBasic/4tH
z = ORD("a") : PRINT CHR(z) ' Prints "a"
http://rosettacode.org/wiki/Character_codes
Character codes
Task Given a character value in your language, print its code   (could be ASCII code, Unicode code, or whatever your language uses). Example The character   'a'   (lowercase letter A)   has a code of 97 in ASCII   (as well as Unicode, as ASCII forms the beginning of Unicode). Conversely, given a code, print out...
#Ursa
Ursa
# outputs the character value for 'a' out (ord "a") endl console # outputs the character 'a' given its value out (chr 97) endl console
http://rosettacode.org/wiki/Character_codes
Character codes
Task Given a character value in your language, print its code   (could be ASCII code, Unicode code, or whatever your language uses). Example The character   'a'   (lowercase letter A)   has a code of 97 in ASCII   (as well as Unicode, as ASCII forms the beginning of Unicode). Conversely, given a code, print out...
#Ursala
Ursala
#import std #import nat   chr = -: num characters asc = -:@rlXS num characters   #cast %cnX   test = (chr97,asc`a)
http://rosettacode.org/wiki/Character_codes
Character codes
Task Given a character value in your language, print its code   (could be ASCII code, Unicode code, or whatever your language uses). Example The character   'a'   (lowercase letter A)   has a code of 97 in ASCII   (as well as Unicode, as ASCII forms the beginning of Unicode). Conversely, given a code, print out...
#VBA
VBA
Debug.Print Chr(97) 'Prints a Debug.Print [Code("a")] ' Prints 97
http://rosettacode.org/wiki/Character_codes
Character codes
Task Given a character value in your language, print its code   (could be ASCII code, Unicode code, or whatever your language uses). Example The character   'a'   (lowercase letter A)   has a code of 97 in ASCII   (as well as Unicode, as ASCII forms the beginning of Unicode). Conversely, given a code, print out...
#VBScript
VBScript
  'prints a WScript.StdOut.WriteLine Chr(97)   'prints 97 WScript.StdOut.WriteLine Asc("a")  
http://rosettacode.org/wiki/Character_codes
Character codes
Task Given a character value in your language, print its code   (could be ASCII code, Unicode code, or whatever your language uses). Example The character   'a'   (lowercase letter A)   has a code of 97 in ASCII   (as well as Unicode, as ASCII forms the beginning of Unicode). Conversely, given a code, print out...
#Vim_Script
Vim Script
"encoding is set to utf-8 echo char2nr("a") "Prints 97   echo nr2char(97) "Prints a
http://rosettacode.org/wiki/Character_codes
Character codes
Task Given a character value in your language, print its code   (could be ASCII code, Unicode code, or whatever your language uses). Example The character   'a'   (lowercase letter A)   has a code of 97 in ASCII   (as well as Unicode, as ASCII forms the beginning of Unicode). Conversely, given a code, print out...
#Visual_Basic_.NET
Visual Basic .NET
Console.WriteLine(Chr(97)) 'Prints a Console.WriteLine(Asc("a")) 'Prints 97
http://rosettacode.org/wiki/Character_codes
Character codes
Task Given a character value in your language, print its code   (could be ASCII code, Unicode code, or whatever your language uses). Example The character   'a'   (lowercase letter A)   has a code of 97 in ASCII   (as well as Unicode, as ASCII forms the beginning of Unicode). Conversely, given a code, print out...
#Vlang
Vlang
fn main() { println('a'[0]) // prints "97" println('π'[0]) // prints "207"   s := 'aπ' println('string cast to bytes: ${s.bytes()}') for c in s { print('0x${c:x} ') } }
http://rosettacode.org/wiki/Character_codes
Character codes
Task Given a character value in your language, print its code   (could be ASCII code, Unicode code, or whatever your language uses). Example The character   'a'   (lowercase letter A)   has a code of 97 in ASCII   (as well as Unicode, as ASCII forms the beginning of Unicode). Conversely, given a code, print out...
#Wren
Wren
var cps = [] for (c in ["a", "π", "字", "🐘"]) { var cp = c.codePoints[0] cps.add(cp) System.print("%(c) = %(cp)") } System.print() for (i in cps) { var c = String.fromCodePoint(i) System.print("%(i) = %(c)") }
http://rosettacode.org/wiki/Character_codes
Character codes
Task Given a character value in your language, print its code   (could be ASCII code, Unicode code, or whatever your language uses). Example The character   'a'   (lowercase letter A)   has a code of 97 in ASCII   (as well as Unicode, as ASCII forms the beginning of Unicode). Conversely, given a code, print out...
#XLISP
XLISP
[1] (INTEGER->CHAR 97)   #\a [2] (CHAR->INTEGER #\a)   97
http://rosettacode.org/wiki/Character_codes
Character codes
Task Given a character value in your language, print its code   (could be ASCII code, Unicode code, or whatever your language uses). Example The character   'a'   (lowercase letter A)   has a code of 97 in ASCII   (as well as Unicode, as ASCII forms the beginning of Unicode). Conversely, given a code, print out...
#XPL0
XPL0
IntOut(0, ^a); \(Integer Out) displays "97" on the console (device 0) ChOut(0, 97); \(Character Out) displays "a" on the console (device 0)
http://rosettacode.org/wiki/Character_codes
Character codes
Task Given a character value in your language, print its code   (could be ASCII code, Unicode code, or whatever your language uses). Example The character   'a'   (lowercase letter A)   has a code of 97 in ASCII   (as well as Unicode, as ASCII forms the beginning of Unicode). Conversely, given a code, print out...
#Z80_Assembly
Z80 Assembly
LD A,'a' call &BB5a
http://rosettacode.org/wiki/Character_codes
Character codes
Task Given a character value in your language, print its code   (could be ASCII code, Unicode code, or whatever your language uses). Example The character   'a'   (lowercase letter A)   has a code of 97 in ASCII   (as well as Unicode, as ASCII forms the beginning of Unicode). Conversely, given a code, print out...
#Zig
Zig
const std = @import("std");   const debug = std.debug; const unicode = std.unicode;   test "character codes" { debug.warn("\n", .{});   // Zig's string is just an array of bytes (u8). const message = "ABCabc";   for (message) |val| { debug.warn(" '{c}' code: {} [hexa: 0x{x}]\n", .{ val, val, va...
http://rosettacode.org/wiki/Character_codes
Character codes
Task Given a character value in your language, print its code   (could be ASCII code, Unicode code, or whatever your language uses). Example The character   'a'   (lowercase letter A)   has a code of 97 in ASCII   (as well as Unicode, as ASCII forms the beginning of Unicode). Conversely, given a code, print out...
#zkl
zkl
"a".toAsc() //-->97 (97).toChar() //-->"a"
http://rosettacode.org/wiki/Character_codes
Character codes
Task Given a character value in your language, print its code   (could be ASCII code, Unicode code, or whatever your language uses). Example The character   'a'   (lowercase letter A)   has a code of 97 in ASCII   (as well as Unicode, as ASCII forms the beginning of Unicode). Conversely, given a code, print out...
#Zoea
Zoea
  program: character_codes input: a output: 97  
http://rosettacode.org/wiki/Character_codes
Character codes
Task Given a character value in your language, print its code   (could be ASCII code, Unicode code, or whatever your language uses). Example The character   'a'   (lowercase letter A)   has a code of 97 in ASCII   (as well as Unicode, as ASCII forms the beginning of Unicode). Conversely, given a code, print out...
#Zoea_Visual
Zoea Visual
10 PRINT CHR$ 97: REM prints a 20 PRINT CODE "a": REM prints 97
http://rosettacode.org/wiki/Character_codes
Character codes
Task Given a character value in your language, print its code   (could be ASCII code, Unicode code, or whatever your language uses). Example The character   'a'   (lowercase letter A)   has a code of 97 in ASCII   (as well as Unicode, as ASCII forms the beginning of Unicode). Conversely, given a code, print out...
#ZX_Spectrum_Basic
ZX Spectrum Basic
10 PRINT CHR$ 97: REM prints a 20 PRINT CODE "a": REM prints 97
http://rosettacode.org/wiki/Chaocipher
Chaocipher
Description The Chaocipher was invented by J.F.Byrne in 1918 and, although simple by modern cryptographic standards, does not appear to have been broken until the algorithm was finally disclosed by his family in 2010. The algorithm is described in this paper by M.Rubin in 2010 and there is a C# implementation here. ...
#11l
11l
F correct_case(string) R string.filter(s -> s.is_alpha()).map(s -> s.uppercase()).join(‘’)   F permu(String alp; num) R alp[num..]‘’alp[0 .< num]   F rotate_wheels(lalph, ralph, key) V newin = ralph.index(key) R (permu(lalph, newin), permu(ralph, newin))   F scramble_wheels(String =lalph, String =ralph) ...
http://rosettacode.org/wiki/Chaocipher
Chaocipher
Description The Chaocipher was invented by J.F.Byrne in 1918 and, although simple by modern cryptographic standards, does not appear to have been broken until the algorithm was finally disclosed by his family in 2010. The algorithm is described in this paper by M.Rubin in 2010 and there is a C# implementation here. ...
#Ada
Ada
  with Ada.Text_IO; use Ada.Text_IO;   procedure chao_slices is type iMode is (Encrypt, Decrypt);   L_Alphabet : String := "HXUCZVAMDSLKPEFJRIGTWOBNYQ"; R_Alphabet : String := "PTLNBQDEOYSFAVZKGJRIHWXUMC"; plaintext  : String := "WELLDONEISBETTERTHANWELLSAID"; ciphertext : String (1 .. plaintext'length);...
http://rosettacode.org/wiki/Catalan_numbers/Pascal%27s_triangle
Catalan numbers/Pascal's triangle
Task Print out the first   15   Catalan numbers by extracting them from Pascal's triangle. See   Catalan Numbers and the Pascal Triangle.     This method enables calculation of Catalan Numbers using only addition and subtraction.   Catalan's Triangle for a Number Triangle that generates Catalan Numbers using onl...
#11l
11l
V n = 15 V t = [0] * (n + 2) t[1] = 1 L(i) 1 .. n L(j) (i .< 1).step(-1) t[j] += t[j - 1] t[i + 1] = t[i] L(j) (i + 1 .< 1).step(-1) t[j] += t[j - 1] print(t[i + 1] - t[i], end' ‘ ’)
http://rosettacode.org/wiki/Chaocipher
Chaocipher
Description The Chaocipher was invented by J.F.Byrne in 1918 and, although simple by modern cryptographic standards, does not appear to have been broken until the algorithm was finally disclosed by his family in 2010. The algorithm is described in this paper by M.Rubin in 2010 and there is a C# implementation here. ...
#AppleScript
AppleScript
-- Chaocipher algorithm by J.F.Byrne 1918. on chaocipher(input, |key|, mode) -- input: text to be enciphered or deciphered. -- |key|: script object or record with leftAlpha and rightAlpha properties, each of whose values is a shuffled alphabet text. -- mode: the text "encipher" or "decipher". script o ...
http://rosettacode.org/wiki/Catalan_numbers/Pascal%27s_triangle
Catalan numbers/Pascal's triangle
Task Print out the first   15   Catalan numbers by extracting them from Pascal's triangle. See   Catalan Numbers and the Pascal Triangle.     This method enables calculation of Catalan Numbers using only addition and subtraction.   Catalan's Triangle for a Number Triangle that generates Catalan Numbers using onl...
#360_Assembly
360 Assembly
CATALAN CSECT USING CATALAN,R13,R12 SAVEAREA B STM-SAVEAREA(R15) DC 17F'0' DC CL8'CATALAN' STM STM R14,R12,12(R13) ST R13,4(R15) ST R15,8(R13) LR R13,R15 LA R12,4095(R13) LA R12,1(...
http://rosettacode.org/wiki/Catalan_numbers/Pascal%27s_triangle
Catalan numbers/Pascal's triangle
Task Print out the first   15   Catalan numbers by extracting them from Pascal's triangle. See   Catalan Numbers and the Pascal Triangle.     This method enables calculation of Catalan Numbers using only addition and subtraction.   Catalan's Triangle for a Number Triangle that generates Catalan Numbers using onl...
#Action.21
Action!
INCLUDE "D2:REAL.ACT" ;from the Action! Tool Ki   DEFINE PTR="CARD" DEFINE REALSIZE="6"   PTR FUNC GetItemAddr(PTR buf BYTE i) RETURN (buf+REALSIZE*i)   PROC Main() DEFINE COUNT="15" BYTE ARRAY buf(102) ;(COUNT+2)*REALSIZE REAL POINTER r1,r2 REAL c BYTE i,j   Put(125) PutE() ;clear the screen   r1=GetItem...
http://rosettacode.org/wiki/Chaocipher
Chaocipher
Description The Chaocipher was invented by J.F.Byrne in 1918 and, although simple by modern cryptographic standards, does not appear to have been broken until the algorithm was finally disclosed by his family in 2010. The algorithm is described in this paper by M.Rubin in 2010 and there is a C# implementation here. ...
#Arc
Arc
(= lshift '((0 1) (2 14) (1 2) (14 26))) (= rshift '((1 3) (4 15) (3 4) (15 26) (0 1)))   (= rot (fn (alpha shift) (let shift (mod shift 26) (string (cut alpha shift) (cut alpha 0 shift)))))   (= scramble-wheel (fn (alpha moves) (= oput '()) (up i 0 (- (len moves) 1) (push (cut alpha ((moves i) 0) ((mov...
http://rosettacode.org/wiki/Catalan_numbers/Pascal%27s_triangle
Catalan numbers/Pascal's triangle
Task Print out the first   15   Catalan numbers by extracting them from Pascal's triangle. See   Catalan Numbers and the Pascal Triangle.     This method enables calculation of Catalan Numbers using only addition and subtraction.   Catalan's Triangle for a Number Triangle that generates Catalan Numbers using onl...
#Ada
Ada
with Ada.Text_IO, Pascal;   procedure Catalan is   Last: Positive := 15; Row: Pascal.Row := Pascal.First_Row(2*Last+1);   begin for I in 1 .. Last loop Row := Pascal.Next_Row(Row); Row := Pascal.Next_Row(Row); Ada.Text_IO.Put(Integer'Image(Row(I+1)-Row(I+2))); end loop; end Catalan;
http://rosettacode.org/wiki/Catalan_numbers/Pascal%27s_triangle
Catalan numbers/Pascal's triangle
Task Print out the first   15   Catalan numbers by extracting them from Pascal's triangle. See   Catalan Numbers and the Pascal Triangle.     This method enables calculation of Catalan Numbers using only addition and subtraction.   Catalan's Triangle for a Number Triangle that generates Catalan Numbers using onl...
#ALGOL_68
ALGOL 68
INT n = 15; [ 0 : n + 1 ]INT t; t[0] := 0; t[1] := 1; FOR i TO n DO FOR j FROM i BY -1 TO 2 DO t[j] := t[j] + t[j-1] OD; t[i+1] := t[i]; FOR j FROM i+1 BY -1 TO 2 DO t[j] := t[j] + t[j-1] OD; print( ( whole( t[i+1] - t[i], 0 ), " " ) ) OD
http://rosettacode.org/wiki/Case-sensitivity_of_identifiers
Case-sensitivity of identifiers
Three dogs (Are there three dogs or one dog?) is a code snippet used to illustrate the lettercase sensitivity of the programming language. For a case-sensitive language, the identifiers dog, Dog and DOG are all different and we should get the output: The three dogs are named Benjamin, Samba and Bernie. For a language...
#11l
11l
V dog = ‘Benjamin’ V Dog = ‘Samba’ V DOG = ‘Bernie’ print(‘The three dogs are named ’dog‘, ’Dog‘ and ’DOG‘.’)
http://rosettacode.org/wiki/Chaocipher
Chaocipher
Description The Chaocipher was invented by J.F.Byrne in 1918 and, although simple by modern cryptographic standards, does not appear to have been broken until the algorithm was finally disclosed by his family in 2010. The algorithm is described in this paper by M.Rubin in 2010 and there is a C# implementation here. ...
#AutoHotkey
AutoHotkey
LeftW := "HXUCZVAMDSLKPEFJRIGTWOBNYQ" RghtW := "PTLNBQDEOYSFAVZKGJRIHWXUMC"   PlainText := "WELLDONEISBETTERTHANWELLSAID" CipherText := Chao_Cipher(PlainText, LeftW, RghtW) ; "OAHQHCNYNXTSZJRRHJBYHQKSOUJY" DecipherText:= Chao_Decipher(CipherText, LeftW, RghtW) ; "WELLDONEISBETTERTHANWELLSAID"   MsgBox % Re...
http://rosettacode.org/wiki/Catalan_numbers/Pascal%27s_triangle
Catalan numbers/Pascal's triangle
Task Print out the first   15   Catalan numbers by extracting them from Pascal's triangle. See   Catalan Numbers and the Pascal Triangle.     This method enables calculation of Catalan Numbers using only addition and subtraction.   Catalan's Triangle for a Number Triangle that generates Catalan Numbers using onl...
#ALGOL_W
ALGOL W
begin  % print the first 15 Catalan numbers from Pascal's triangle % integer n; n := 15; begin integer array pascalLine ( 1 :: n + 1 );  % the Catalan numbers are the differences between the middle and middle - 1 numbers of the odd %  % lines of Pascal's triangle (lines with 3 or mo...
http://rosettacode.org/wiki/Catalan_numbers/Pascal%27s_triangle
Catalan numbers/Pascal's triangle
Task Print out the first   15   Catalan numbers by extracting them from Pascal's triangle. See   Catalan Numbers and the Pascal Triangle.     This method enables calculation of Catalan Numbers using only addition and subtraction.   Catalan's Triangle for a Number Triangle that generates Catalan Numbers using onl...
#APL
APL
  ⍝ Based heavily on the J solution CATALAN←{¯1↓↑-/1 ¯1↓¨(⊂⎕IO+0 0)⍉¨0 2⌽¨⊂(⎕IO-⍨⍳N){+\⍣⍺⊢⍵}⍤0 1⊢1⍴⍨N←⍵+2}  
http://rosettacode.org/wiki/Case-sensitivity_of_identifiers
Case-sensitivity of identifiers
Three dogs (Are there three dogs or one dog?) is a code snippet used to illustrate the lettercase sensitivity of the programming language. For a case-sensitive language, the identifiers dog, Dog and DOG are all different and we should get the output: The three dogs are named Benjamin, Samba and Bernie. For a language...
#Action.21
Action!
PROC Main() CHAR ARRAY dog="Bernie"   PrintF("There is just one dog named %S.",dog) RETURN
http://rosettacode.org/wiki/Case-sensitivity_of_identifiers
Case-sensitivity of identifiers
Three dogs (Are there three dogs or one dog?) is a code snippet used to illustrate the lettercase sensitivity of the programming language. For a case-sensitive language, the identifiers dog, Dog and DOG are all different and we should get the output: The three dogs are named Benjamin, Samba and Bernie. For a language...
#Ada
Ada
with Ada.Text_IO; procedure Dogs is Dog : String := "Bernie"; begin Ada.Text_IO.Put_Line ("There is just one dog named " & DOG); end Dogs;
http://rosettacode.org/wiki/Chaocipher
Chaocipher
Description The Chaocipher was invented by J.F.Byrne in 1918 and, although simple by modern cryptographic standards, does not appear to have been broken until the algorithm was finally disclosed by his family in 2010. The algorithm is described in this paper by M.Rubin in 2010 and there is a C# implementation here. ...
#C
C
#include <stdio.h> #include <string.h> #include <stdlib.h>   #define TRUE 1 #define FALSE 0   typedef int bool; typedef enum { ENCRYPT, DECRYPT } cmode;   const char *l_alphabet = "HXUCZVAMDSLKPEFJRIGTWOBNYQ"; const char *r_alphabet = "PTLNBQDEOYSFAVZKGJRIHWXUMC";   void chao(const char *in, char *out, cmode mode, bool...
http://rosettacode.org/wiki/Catalan_numbers/Pascal%27s_triangle
Catalan numbers/Pascal's triangle
Task Print out the first   15   Catalan numbers by extracting them from Pascal's triangle. See   Catalan Numbers and the Pascal Triangle.     This method enables calculation of Catalan Numbers using only addition and subtraction.   Catalan's Triangle for a Number Triangle that generates Catalan Numbers using onl...
#AutoHotkey
AutoHotkey
/* Generate Catalan Numbers // // smgs: 20th Feb, 2014 */ Array := [], Array[2,1] := Array[2,2] := 1 ; Array inititated and 2nd row of pascal's triangle assigned INI := 3 ; starts with calculating the 3rd row and as such the value Loop, 31 ; every odd row is taken for calculating catalan number as such to obtain 15 we ...
http://rosettacode.org/wiki/Case-sensitivity_of_identifiers
Case-sensitivity of identifiers
Three dogs (Are there three dogs or one dog?) is a code snippet used to illustrate the lettercase sensitivity of the programming language. For a case-sensitive language, the identifiers dog, Dog and DOG are all different and we should get the output: The three dogs are named Benjamin, Samba and Bernie. For a language...
#Agena
Agena
scope local dog := "Benjamin"; scope local Dog := "Samba"; scope local DOG := "Bernie"; if DOG <> Dog or DOG <> dog then print( "The three dogs are named: " & dog & ", " & Dog & " and " & DOG ) else print( "There is just one dog named: " & DOG ) ...
http://rosettacode.org/wiki/Case-sensitivity_of_identifiers
Case-sensitivity of identifiers
Three dogs (Are there three dogs or one dog?) is a code snippet used to illustrate the lettercase sensitivity of the programming language. For a case-sensitive language, the identifiers dog, Dog and DOG are all different and we should get the output: The three dogs are named Benjamin, Samba and Bernie. For a language...
#Aime
Aime
text dog, Dog, DOG;   dog = "Benjamin"; Dog = "Samba"; DOG = "Bernie";   o_form("The three dogs are named ~, ~ and ~.\n", dog, Dog, DOG);
http://rosettacode.org/wiki/Chaocipher
Chaocipher
Description The Chaocipher was invented by J.F.Byrne in 1918 and, although simple by modern cryptographic standards, does not appear to have been broken until the algorithm was finally disclosed by his family in 2010. The algorithm is described in this paper by M.Rubin in 2010 and there is a C# implementation here. ...
#C.23
C#
using System;   namespace Chaocipher { enum Mode { ENCRYPT, DECRYPT, }   class Program { const string L_ALPHABET = "HXUCZVAMDSLKPEFJRIGTWOBNYQ"; const string R_ALPHABET = "PTLNBQDEOYSFAVZKGJRIHWXUMC";   static string Exec(string text, Mode mode, bool showSteps = false...
http://rosettacode.org/wiki/Catalan_numbers/Pascal%27s_triangle
Catalan numbers/Pascal's triangle
Task Print out the first   15   Catalan numbers by extracting them from Pascal's triangle. See   Catalan Numbers and the Pascal Triangle.     This method enables calculation of Catalan Numbers using only addition and subtraction.   Catalan's Triangle for a Number Triangle that generates Catalan Numbers using onl...
#AWK
AWK
  # syntax: GAWK -f CATALAN_NUMBERS_PASCALS_TRIANGLE.AWK # converted from C BEGIN { printf("1") for (n=2; n<=15; n++) { num = den = 1 for (k=2; k<=n; k++) { num *= (n + k) den *= k catalan = num / den } printf(" %d",catalan) } printf("\n") exit(0) }  
http://rosettacode.org/wiki/Case-sensitivity_of_identifiers
Case-sensitivity of identifiers
Three dogs (Are there three dogs or one dog?) is a code snippet used to illustrate the lettercase sensitivity of the programming language. For a case-sensitive language, the identifiers dog, Dog and DOG are all different and we should get the output: The three dogs are named Benjamin, Samba and Bernie. For a language...
#ALGOL_68
ALGOL 68
#!/usr/bin/a68g --script # # -*- coding: utf-8 -*- #   STRING dog = "Benjamin"; OP D = (INT og)STRING: "Samba"; OP DOG = (INT gy)STRING: "Bernie"; INT og=~, gy=~;   main:( printf(($"The three dogs are named "g", "g" and "g"."l$, dog, Dog, DOGgy)); 0 )
http://rosettacode.org/wiki/Case-sensitivity_of_identifiers
Case-sensitivity of identifiers
Three dogs (Are there three dogs or one dog?) is a code snippet used to illustrate the lettercase sensitivity of the programming language. For a case-sensitive language, the identifiers dog, Dog and DOG are all different and we should get the output: The three dogs are named Benjamin, Samba and Bernie. For a language...
#ALGOL_W
ALGOL W
begin string(8) dog; dog := "Benjamin"; begin string(8) Dog; Dog := "Samba"; begin string(8) DOG; DOG := "Bernie"; if DOG not = Dog or DOG not = dog then write( "The three dogs are named: ", dog, ", ", Dog, " and ", DOG ) ...
http://rosettacode.org/wiki/Chaocipher
Chaocipher
Description The Chaocipher was invented by J.F.Byrne in 1918 and, although simple by modern cryptographic standards, does not appear to have been broken until the algorithm was finally disclosed by his family in 2010. The algorithm is described in this paper by M.Rubin in 2010 and there is a C# implementation here. ...
#C.2B.2B
C++
#include <iostream>   enum class Mode { ENCRYPT, DECRYPT, };   const std::string L_ALPHABET = "HXUCZVAMDSLKPEFJRIGTWOBNYQ"; const std::string R_ALPHABET = "PTLNBQDEOYSFAVZKGJRIHWXUMC";   std::string exec(std::string text, Mode mode, bool showSteps = false) { auto left = L_ALPHABET; auto right = R_ALPHAB...
http://rosettacode.org/wiki/Catalan_numbers/Pascal%27s_triangle
Catalan numbers/Pascal's triangle
Task Print out the first   15   Catalan numbers by extracting them from Pascal's triangle. See   Catalan Numbers and the Pascal Triangle.     This method enables calculation of Catalan Numbers using only addition and subtraction.   Catalan's Triangle for a Number Triangle that generates Catalan Numbers using onl...
#Batch_File
Batch File
@echo off setlocal ENABLEDELAYEDEXPANSION set n=15 set /A nn=n+1 for /L %%i in (0,1,%nn%) do set t.%%i=0 set t.1=1 for /L %%i in (1,1,%n%) do ( set /A ip=%%i+1 for /L %%j in (%%i,-1,1) do ( set /A jm=%%j-1 set /A t.%%j=t.%%j+t.!jm! ) set /A t.!ip!=t.%%i for /L %%j in (!ip!,-1,1) do ( ...
http://rosettacode.org/wiki/Case-sensitivity_of_identifiers
Case-sensitivity of identifiers
Three dogs (Are there three dogs or one dog?) is a code snippet used to illustrate the lettercase sensitivity of the programming language. For a case-sensitive language, the identifiers dog, Dog and DOG are all different and we should get the output: The three dogs are named Benjamin, Samba and Bernie. For a language...
#APL
APL
DOG←'Benjamin' Dog←'Samba' dog←'Bernie' 'The three dogs are named ',DOG,', ',Dog,', and ',dog The three dogs are named Benjamin, Samba, and Bernie
http://rosettacode.org/wiki/Case-sensitivity_of_identifiers
Case-sensitivity of identifiers
Three dogs (Are there three dogs or one dog?) is a code snippet used to illustrate the lettercase sensitivity of the programming language. For a case-sensitive language, the identifiers dog, Dog and DOG are all different and we should get the output: The three dogs are named Benjamin, Samba and Bernie. For a language...
#Arturo
Arturo
dog: "Benjamin" Dog: "Samba" DOG: "Bernie"   dogs: @[dog Dog DOG]   print ["The" size dogs "dog(s) are named" join.with:", " dogs]
http://rosettacode.org/wiki/Chaocipher
Chaocipher
Description The Chaocipher was invented by J.F.Byrne in 1918 and, although simple by modern cryptographic standards, does not appear to have been broken until the algorithm was finally disclosed by his family in 2010. The algorithm is described in this paper by M.Rubin in 2010 and there is a C# implementation here. ...
#D
D
import std.stdio; import std.string;   immutable L_ALPHABET = "HXUCZVAMDSLKPEFJRIGTWOBNYQ"; immutable R_ALPHABET = "PTLNBQDEOYSFAVZKGJRIHWXUMC";   enum Mode { ENCRYPT, DECRYPT, }   string exec(string text, Mode mode, bool showSteps = false) { char[] left = L_ALPHABET.dup; char[] right = R_ALPHABET.dup; ...
http://rosettacode.org/wiki/Catalan_numbers/Pascal%27s_triangle
Catalan numbers/Pascal's triangle
Task Print out the first   15   Catalan numbers by extracting them from Pascal's triangle. See   Catalan Numbers and the Pascal Triangle.     This method enables calculation of Catalan Numbers using only addition and subtraction.   Catalan's Triangle for a Number Triangle that generates Catalan Numbers using onl...
#C
C
  //This code implements the print of 15 first Catalan's Numbers //Formula used: // __n__ // | | (n + k) / k n>0 // k=2   #include <stdio.h> #include <stdlib.h>   //the number of Catalan's Numbers to be printed const int N = 15;   int main() { //loop variables (in registers) register int k, n;   //...
http://rosettacode.org/wiki/Case-sensitivity_of_identifiers
Case-sensitivity of identifiers
Three dogs (Are there three dogs or one dog?) is a code snippet used to illustrate the lettercase sensitivity of the programming language. For a case-sensitive language, the identifiers dog, Dog and DOG are all different and we should get the output: The three dogs are named Benjamin, Samba and Bernie. For a language...
#AutoHotkey
AutoHotkey
dog := "Benjamin" Dog := "Samba" DOG := "Bernie" MsgBox There is just one dog named %dOG%
http://rosettacode.org/wiki/Case-sensitivity_of_identifiers
Case-sensitivity of identifiers
Three dogs (Are there three dogs or one dog?) is a code snippet used to illustrate the lettercase sensitivity of the programming language. For a case-sensitive language, the identifiers dog, Dog and DOG are all different and we should get the output: The three dogs are named Benjamin, Samba and Bernie. For a language...
#AWK
AWK
BEGIN { dog = "Benjamin" Dog = "Samba" DOG = "Bernie" printf "The three dogs are named %s, %s and %s.\n", dog, Dog, DOG }
http://rosettacode.org/wiki/Catamorphism
Catamorphism
Reduce is a function or method that is used to take the values in an array or a list and apply a function to successive members of the list to produce (or reduce them to), a single value. Task Show how reduce (or foldl or foldr etc), work (or would be implemented) in your language. See also Wikipedia article: ...
#11l
11l
print((1..3).reduce((x, y) -> x + y)) print((1..3).reduce(3, (x, y) -> x + y)) print([1, 1, 3].reduce((x, y) -> x + y)) print([1, 1, 3].reduce(2, (x, y) -> x + y))
http://rosettacode.org/wiki/Chaocipher
Chaocipher
Description The Chaocipher was invented by J.F.Byrne in 1918 and, although simple by modern cryptographic standards, does not appear to have been broken until the algorithm was finally disclosed by his family in 2010. The algorithm is described in this paper by M.Rubin in 2010 and there is a C# implementation here. ...
#Delphi
Delphi
  program Chaocipher;   {$APPTYPE CONSOLE}   uses System.SysUtils;   type TMode = (mcEncrypt, mcDecrypt);   const lAlphabet = 'HXUCZVAMDSLKPEFJRIGTWOBNYQ'; rAlphabet = 'PTLNBQDEOYSFAVZKGJRIHWXUMC';   function Chao(text: AnsiString; Mode: TMode; showSteps: boolean): AnsiString; begin var len := Length(text);  ...
http://rosettacode.org/wiki/Catalan_numbers/Pascal%27s_triangle
Catalan numbers/Pascal's triangle
Task Print out the first   15   Catalan numbers by extracting them from Pascal's triangle. See   Catalan Numbers and the Pascal Triangle.     This method enables calculation of Catalan Numbers using only addition and subtraction.   Catalan's Triangle for a Number Triangle that generates Catalan Numbers using onl...
#C.23
C#
  int n = 15; List<int> t = new List<int>() { 0, 1 }; for (int i = 1; i <= n; i++) { for (var j = i; j > 1; j--) t[j] += t[j - 1]; t.Add(t[i]); for (var j = i + 1; j > 1; j--) t[j] += t[j - 1]; Console.Write(((i == 1) ? "" : ", ") + (t[i + 1] - t[i])); }  
http://rosettacode.org/wiki/Case-sensitivity_of_identifiers
Case-sensitivity of identifiers
Three dogs (Are there three dogs or one dog?) is a code snippet used to illustrate the lettercase sensitivity of the programming language. For a case-sensitive language, the identifiers dog, Dog and DOG are all different and we should get the output: The three dogs are named Benjamin, Samba and Bernie. For a language...
#BASIC
BASIC
DOG$ = "Benjamin" DOG$ = "Samba" DOG$ = "Bernie" PRINT "There is just one dog, named "; DOG$
http://rosettacode.org/wiki/Case-sensitivity_of_identifiers
Case-sensitivity of identifiers
Three dogs (Are there three dogs or one dog?) is a code snippet used to illustrate the lettercase sensitivity of the programming language. For a case-sensitive language, the identifiers dog, Dog and DOG are all different and we should get the output: The three dogs are named Benjamin, Samba and Bernie. For a language...
#BASIC256
BASIC256
dog = "Benjamin" Dog = "Samba" DOG = "Bernie" print "There is just one dog, named "; dog end
http://rosettacode.org/wiki/Catamorphism
Catamorphism
Reduce is a function or method that is used to take the values in an array or a list and apply a function to successive members of the list to produce (or reduce them to), a single value. Task Show how reduce (or foldl or foldr etc), work (or would be implemented) in your language. See also Wikipedia article: ...
#6502_Assembly
6502 Assembly
define catbuf $10 define catbuf_temp $12   ldx #0 ramloop: txa sta $00,x inx cpx #$10 bne ramloop ;load zero page addresses $00-$0f with values equal ;to that address     ldx #0 ;zero X loop_cata: lda $00,x ;load the zeroth element clc adc $01,x ;add the first to it. inx inx ;inx twice. Otherwise the same element ...
http://rosettacode.org/wiki/Chaocipher
Chaocipher
Description The Chaocipher was invented by J.F.Byrne in 1918 and, although simple by modern cryptographic standards, does not appear to have been broken until the algorithm was finally disclosed by his family in 2010. The algorithm is described in this paper by M.Rubin in 2010 and there is a C# implementation here. ...
#F.23
F#
  // Implement Chaocipher. Nigel Galloway: July 13th., 2019 let pL n=function g when g=n->0 |g when g=(n+1)%26->13 |g->let x=(25+g-n)%26 in if x<13 then x else x+1 let pR n=function g when g=n->25 |g when g=(n+3)%26->13 |g when g=(n+1)%26->0 |g when g=(n+2)%26->1 |g->let x=(24+g-n)%26 in if x<13 then x else x+1 let enc...
http://rosettacode.org/wiki/Catalan_numbers/Pascal%27s_triangle
Catalan numbers/Pascal's triangle
Task Print out the first   15   Catalan numbers by extracting them from Pascal's triangle. See   Catalan Numbers and the Pascal Triangle.     This method enables calculation of Catalan Numbers using only addition and subtraction.   Catalan's Triangle for a Number Triangle that generates Catalan Numbers using onl...
#C.2B.2B
C++
// Generate Catalan Numbers // // Nigel Galloway: June 9th., 2012 // #include <iostream> int main() { const int N = 15; int t[N+2] = {0,1}; for(int i = 1; i<=N; i++){ for(int j = i; j>1; j--) t[j] = t[j] + t[j-1]; t[i+1] = t[i]; for(int j = i+1; j>1; j--) t[j] = t[j] + t[j-1]; std::cout << t[i+1] ...
http://rosettacode.org/wiki/Case-sensitivity_of_identifiers
Case-sensitivity of identifiers
Three dogs (Are there three dogs or one dog?) is a code snippet used to illustrate the lettercase sensitivity of the programming language. For a case-sensitive language, the identifiers dog, Dog and DOG are all different and we should get the output: The three dogs are named Benjamin, Samba and Bernie. For a language...
#Batch_File
Batch File
  @echo off   set dog=Benjamin set Dog=Samba set DOG=Bernie   echo There is just one dog named %dog%. pause>nul  
http://rosettacode.org/wiki/Case-sensitivity_of_identifiers
Case-sensitivity of identifiers
Three dogs (Are there three dogs or one dog?) is a code snippet used to illustrate the lettercase sensitivity of the programming language. For a case-sensitive language, the identifiers dog, Dog and DOG are all different and we should get the output: The three dogs are named Benjamin, Samba and Bernie. For a language...
#BBC_BASIC
BBC BASIC
dog$ = "Benjamin" Dog$ = "Samba" DOG$ = "Bernie" PRINT "The three dogs are " dog$ ", " Dog$ " and " DOG$ "."
http://rosettacode.org/wiki/Catamorphism
Catamorphism
Reduce is a function or method that is used to take the values in an array or a list and apply a function to successive members of the list to produce (or reduce them to), a single value. Task Show how reduce (or foldl or foldr etc), work (or would be implemented) in your language. See also Wikipedia article: ...
#ABAP
ABAP
  report z_catamorphism.   data(numbers) = value int4_table( ( 1 ) ( 2 ) ( 3 ) ( 4 ) ( 5 ) ).   write: |numbers = { reduce string( init output = `[` index = 1 for number in numbers next output = cond string( when index eq lines( numbers ) then |{ output }, { number } ]| when inde...
http://rosettacode.org/wiki/Chaocipher
Chaocipher
Description The Chaocipher was invented by J.F.Byrne in 1918 and, although simple by modern cryptographic standards, does not appear to have been broken until the algorithm was finally disclosed by his family in 2010. The algorithm is described in this paper by M.Rubin in 2010 and there is a C# implementation here. ...
#Factor
Factor
USING: arrays combinators fry io kernel locals math namespaces prettyprint sequences sequences.extras strings ; IN: rosetta-code.chaocipher   CONSTANT: zenith 0 CONSTANT: nadir 13   SYMBOLS: l-alphabet r-alphabet last-index ;   : init-alphabets ( -- ) "HXUCZVAMDSLKPEFJRIGTWOBNYQ" l-alphabet "PTLNBQDEOYSFAVZKGJ...
http://rosettacode.org/wiki/Catalan_numbers/Pascal%27s_triangle
Catalan numbers/Pascal's triangle
Task Print out the first   15   Catalan numbers by extracting them from Pascal's triangle. See   Catalan Numbers and the Pascal Triangle.     This method enables calculation of Catalan Numbers using only addition and subtraction.   Catalan's Triangle for a Number Triangle that generates Catalan Numbers using onl...
#Common_Lisp
Common Lisp
(defun catalan (n) "Return the n-th Catalan number" (if (<= n 1) 1 (let ((result 2)) (dotimes (k (- n 2) result) (setq result (* result (/ (+ n k 2) (+ k 2)))) ))))     (dotimes (n 15) (print (catalan (1+ n))) )
http://rosettacode.org/wiki/Case-sensitivity_of_identifiers
Case-sensitivity of identifiers
Three dogs (Are there three dogs or one dog?) is a code snippet used to illustrate the lettercase sensitivity of the programming language. For a case-sensitive language, the identifiers dog, Dog and DOG are all different and we should get the output: The three dogs are named Benjamin, Samba and Bernie. For a language...
#bc
bc
obase = 16 ibase = 16   /* * Store the hexadecimal number 'BE27A312' * in the variable 'd'. */ d = BE27A312 "There is just one dog named "; d quit
http://rosettacode.org/wiki/Catamorphism
Catamorphism
Reduce is a function or method that is used to take the values in an array or a list and apply a function to successive members of the list to produce (or reduce them to), a single value. Task Show how reduce (or foldl or foldr etc), work (or would be implemented) in your language. See also Wikipedia article: ...
#Ada
Ada
with Ada.Text_IO;   procedure Catamorphism is   type Fun is access function (Left, Right: Natural) return Natural; type Arr is array(Natural range <>) of Natural;   function Fold_Left (F: Fun; A: Arr) return Natural is Result: Natural := A(A'First); begin for I in A'First+1 .. A'Last loop Resu...
http://rosettacode.org/wiki/Chaocipher
Chaocipher
Description The Chaocipher was invented by J.F.Byrne in 1918 and, although simple by modern cryptographic standards, does not appear to have been broken until the algorithm was finally disclosed by his family in 2010. The algorithm is described in this paper by M.Rubin in 2010 and there is a C# implementation here. ...
#F.C5.8Drmul.C3.A6
Fōrmulæ
package main   import( "fmt" "strings" "unicode/utf8" )   type Mode int   const( Encrypt Mode = iota Decrypt )   const( lAlphabet = "HXUCZVAMDSLKPEFJRIGTWOBNYQ" rAlphabet = "PTLNBQDEOYSFAVZKGJRIHWXUMC" )   func Chao(text string, mode Mode, showSteps bool) string { len := len(text) if...
http://rosettacode.org/wiki/Catalan_numbers/Pascal%27s_triangle
Catalan numbers/Pascal's triangle
Task Print out the first   15   Catalan numbers by extracting them from Pascal's triangle. See   Catalan Numbers and the Pascal Triangle.     This method enables calculation of Catalan Numbers using only addition and subtraction.   Catalan's Triangle for a Number Triangle that generates Catalan Numbers using onl...
#D
D
void main() { import std.stdio;   enum uint N = 15; uint[N + 2] t; t[1] = 1;   foreach (immutable i; 1 .. N + 1) { foreach_reverse (immutable j; 2 .. i + 1) t[j] += t[j - 1]; t[i + 1] = t[i]; foreach_reverse (immutable j; 2 .. i + 2) t[j] += t[j - 1]; ...
http://rosettacode.org/wiki/Case-sensitivity_of_identifiers
Case-sensitivity of identifiers
Three dogs (Are there three dogs or one dog?) is a code snippet used to illustrate the lettercase sensitivity of the programming language. For a case-sensitive language, the identifiers dog, Dog and DOG are all different and we should get the output: The three dogs are named Benjamin, Samba and Bernie. For a language...
#Bracmat
Bracmat
( Benjamin:?dog & Samba:?Dog & Bernie:?DOG & out$("There are three dogs:" !dog !Dog and !DOG) );
http://rosettacode.org/wiki/Case-sensitivity_of_identifiers
Case-sensitivity of identifiers
Three dogs (Are there three dogs or one dog?) is a code snippet used to illustrate the lettercase sensitivity of the programming language. For a case-sensitive language, the identifiers dog, Dog and DOG are all different and we should get the output: The three dogs are named Benjamin, Samba and Bernie. For a language...
#Brlcad
Brlcad
  opendb dogs.g y # Create a database to hold our dogs units ft # The dogs are measured in feet in dog.s sph 0 0 0 1 # Benjie is a little Scottie dog in Dog.s sph 4 0 0 3 # Samba is a Labrador in DOG.s sph 13 0 0 5 # Bernie is massive. He is a New Foundland echo The three d...
http://rosettacode.org/wiki/Catamorphism
Catamorphism
Reduce is a function or method that is used to take the values in an array or a list and apply a function to successive members of the list to produce (or reduce them to), a single value. Task Show how reduce (or foldl or foldr etc), work (or would be implemented) in your language. See also Wikipedia article: ...
#Aime
Aime
integer s;   s = 0; list(1, 2, 3, 4, 5, 6, 7, 8, 9).ucall(add_i, 1, s); o_(s, "\n");
http://rosettacode.org/wiki/Chaocipher
Chaocipher
Description The Chaocipher was invented by J.F.Byrne in 1918 and, although simple by modern cryptographic standards, does not appear to have been broken until the algorithm was finally disclosed by his family in 2010. The algorithm is described in this paper by M.Rubin in 2010 and there is a C# implementation here. ...
#Go
Go
package main   import( "fmt" "strings" "unicode/utf8" )   type Mode int   const( Encrypt Mode = iota Decrypt )   const( lAlphabet = "HXUCZVAMDSLKPEFJRIGTWOBNYQ" rAlphabet = "PTLNBQDEOYSFAVZKGJRIHWXUMC" )   func Chao(text string, mode Mode, showSteps bool) string { len := len(text) if...
http://rosettacode.org/wiki/Catalan_numbers/Pascal%27s_triangle
Catalan numbers/Pascal's triangle
Task Print out the first   15   Catalan numbers by extracting them from Pascal's triangle. See   Catalan Numbers and the Pascal Triangle.     This method enables calculation of Catalan Numbers using only addition and subtraction.   Catalan's Triangle for a Number Triangle that generates Catalan Numbers using onl...
#Delphi
Delphi
  (define dim 100) (define-syntax-rule (Tidx i j) (+ i (* dim j)))   ;; generates Catalan's triangle ;; T (i , j) = T(i-1,j) + T (i, j-1)   (define (T n) (define i (modulo n dim)) (define j (quotient n dim)) (cond ((zero? i) 1) ;; left column = 1 ((= i j) (T (Tidx (1- i) j))) ;; diagonal value = left value ...
http://rosettacode.org/wiki/Case-sensitivity_of_identifiers
Case-sensitivity of identifiers
Three dogs (Are there three dogs or one dog?) is a code snippet used to illustrate the lettercase sensitivity of the programming language. For a case-sensitive language, the identifiers dog, Dog and DOG are all different and we should get the output: The three dogs are named Benjamin, Samba and Bernie. For a language...
#C
C
#include <stdio.h>   static const char *dog = "Benjamin"; static const char *Dog = "Samba"; static const char *DOG = "Bernie";   int main() { printf("The three dogs are named %s, %s and %s.\n", dog, Dog, DOG); return 0; }
http://rosettacode.org/wiki/Case-sensitivity_of_identifiers
Case-sensitivity of identifiers
Three dogs (Are there three dogs or one dog?) is a code snippet used to illustrate the lettercase sensitivity of the programming language. For a case-sensitive language, the identifiers dog, Dog and DOG are all different and we should get the output: The three dogs are named Benjamin, Samba and Bernie. For a language...
#C.23
C#
  using System;   class Program { static void Main(string[] args) { string dog = "Benjamin"; string Dog = "Samba"; string DOG = "Bernie"; Console.WriteLine(string.Format("The three dogs are named {0}, {1}, and {2}.", dog, Dog, DOG)); } }
http://rosettacode.org/wiki/Catamorphism
Catamorphism
Reduce is a function or method that is used to take the values in an array or a list and apply a function to successive members of the list to produce (or reduce them to), a single value. Task Show how reduce (or foldl or foldr etc), work (or would be implemented) in your language. See also Wikipedia article: ...
#ALGOL_68
ALGOL 68
# applies fn to successive elements of the array of values # # the result is 0 if there are no values # PROC reduce = ( []INT values, PROC( INT, INT )INT fn )INT: IF UPB values < LWB values THEN # no elements # 0 ELSE # there are some elements # INT result := values[...
http://rosettacode.org/wiki/Chaocipher
Chaocipher
Description The Chaocipher was invented by J.F.Byrne in 1918 and, although simple by modern cryptographic standards, does not appear to have been broken until the algorithm was finally disclosed by his family in 2010. The algorithm is described in this paper by M.Rubin in 2010 and there is a C# implementation here. ...
#Groovy
Groovy
class Chaocipher { private enum Mode { ENCRYPT, DECRYPT }   private static final String L_ALPHABET = "HXUCZVAMDSLKPEFJRIGTWOBNYQ" private static final String R_ALPHABET = "PTLNBQDEOYSFAVZKGJRIHWXUMC"   private static int indexOf(char[] a, char c) { for (int i = 0; i < a.lengt...
http://rosettacode.org/wiki/Catalan_numbers/Pascal%27s_triangle
Catalan numbers/Pascal's triangle
Task Print out the first   15   Catalan numbers by extracting them from Pascal's triangle. See   Catalan Numbers and the Pascal Triangle.     This method enables calculation of Catalan Numbers using only addition and subtraction.   Catalan's Triangle for a Number Triangle that generates Catalan Numbers using onl...
#EchoLisp
EchoLisp
  (define dim 100) (define-syntax-rule (Tidx i j) (+ i (* dim j)))   ;; generates Catalan's triangle ;; T (i , j) = T(i-1,j) + T (i, j-1)   (define (T n) (define i (modulo n dim)) (define j (quotient n dim)) (cond ((zero? i) 1) ;; left column = 1 ((= i j) (T (Tidx (1- i) j))) ;; diagonal value = left value ...
http://rosettacode.org/wiki/Case-sensitivity_of_identifiers
Case-sensitivity of identifiers
Three dogs (Are there three dogs or one dog?) is a code snippet used to illustrate the lettercase sensitivity of the programming language. For a case-sensitive language, the identifiers dog, Dog and DOG are all different and we should get the output: The three dogs are named Benjamin, Samba and Bernie. For a language...
#C.2B.2B
C++
#include <iostream> #include <string> using namespace std;   int main() { string dog = "Benjamin", Dog = "Samba", DOG = "Bernie";   cout << "The three dogs are named " << dog << ", " << Dog << ", and " << DOG << endl; }
http://rosettacode.org/wiki/Case-sensitivity_of_identifiers
Case-sensitivity of identifiers
Three dogs (Are there three dogs or one dog?) is a code snippet used to illustrate the lettercase sensitivity of the programming language. For a case-sensitive language, the identifiers dog, Dog and DOG are all different and we should get the output: The three dogs are named Benjamin, Samba and Bernie. For a language...
#Clojure
Clojure
user=> (let [dog "Benjamin" Dog "Samba" DOG "Bernie"] (format "The three dogs are named %s, %s and %s." dog Dog DOG)) "The three dogs are named Benjamin, Samba and Bernie."
http://rosettacode.org/wiki/Cartesian_product_of_two_or_more_lists
Cartesian product of two or more lists
Task Show one or more idiomatic ways of generating the Cartesian product of two arbitrary lists in your language. Demonstrate that your function/method correctly returns: {1, 2} × {3, 4} = {(1, 3), (1, 4), (2, 3), (2, 4)} and, in contrast: {3, 4} × {1, 2} = {(3, 1), (3, 2), (4, 1), (4, 2)} Also demonstrate, using y...
#11l
11l
F cart_prod(a, b) V p = [(0, 0)] * (a.len * b.len) V i = 0 L(aa) a L(bb) b p[i++] = (aa, bb) R p   print(cart_prod([1, 2], [3, 4])) print(cart_prod([3, 4], [1, 2])) [Int] empty_array print(cart_prod([1, 2], empty_array)) print(cart_prod(empty_array, [1, 2]))
http://rosettacode.org/wiki/Catamorphism
Catamorphism
Reduce is a function or method that is used to take the values in an array or a list and apply a function to successive members of the list to produce (or reduce them to), a single value. Task Show how reduce (or foldl or foldr etc), work (or would be implemented) in your language. See also Wikipedia article: ...
#APL
APL
+/ 1 2 3 4 5 6 7 28 ×/ 1 2 3 4 5 6 7 5040
http://rosettacode.org/wiki/Chaocipher
Chaocipher
Description The Chaocipher was invented by J.F.Byrne in 1918 and, although simple by modern cryptographic standards, does not appear to have been broken until the algorithm was finally disclosed by his family in 2010. The algorithm is described in this paper by M.Rubin in 2010 and there is a C# implementation here. ...
#Haskell
Haskell
import Data.List (elemIndex)   chao :: Eq a => [a] -> [a] -> Bool -> [a] -> [a] chao _ _ _ [] = [] chao l r plain (x : xs) = maybe [] go (elemIndex x src) where (src, dst) | plain = (l, r) | otherwise = (r, l) go n = dst !! n : chao (shifted 1 14 (rotated n l)) ((shifte...
http://rosettacode.org/wiki/Catalan_numbers/Pascal%27s_triangle
Catalan numbers/Pascal's triangle
Task Print out the first   15   Catalan numbers by extracting them from Pascal's triangle. See   Catalan Numbers and the Pascal Triangle.     This method enables calculation of Catalan Numbers using only addition and subtraction.   Catalan's Triangle for a Number Triangle that generates Catalan Numbers using onl...
#EDSAC_order_code
EDSAC order code
  [Catalan numbers from Pascal triangle, Rosetta Code website. EDSAC program, Initial Orders 2] ..PZ [blank tape and terminator] T54K [refer to working array with 'C'] P300F [address of working array] T46K [to call print subroutine with 'G N'] P56F [add...
http://rosettacode.org/wiki/Case-sensitivity_of_identifiers
Case-sensitivity of identifiers
Three dogs (Are there three dogs or one dog?) is a code snippet used to illustrate the lettercase sensitivity of the programming language. For a case-sensitive language, the identifiers dog, Dog and DOG are all different and we should get the output: The three dogs are named Benjamin, Samba and Bernie. For a language...
#COBOL
COBOL
* Case sensitivity of identifiers *>* Commented-out lines in the working storage *>* are considered as invalid redefinitions *>* of ''dog'' that can only be ambiguously *>* referenced in the procedure body.   IDENTIFICATION DIVISION. PROGRAM-ID. case-sensitivity. DATA DI...
http://rosettacode.org/wiki/Case-sensitivity_of_identifiers
Case-sensitivity of identifiers
Three dogs (Are there three dogs or one dog?) is a code snippet used to illustrate the lettercase sensitivity of the programming language. For a case-sensitive language, the identifiers dog, Dog and DOG are all different and we should get the output: The three dogs are named Benjamin, Samba and Bernie. For a language...
#CoffeeScript
CoffeeScript
  dog="Benjamin" Dog = "Samba" DOG = "Bernie" console.log "The three dogs are names #{dog}, #{Dog}, and #{DOG}."  
http://rosettacode.org/wiki/Cartesian_product_of_two_or_more_lists
Cartesian product of two or more lists
Task Show one or more idiomatic ways of generating the Cartesian product of two arbitrary lists in your language. Demonstrate that your function/method correctly returns: {1, 2} × {3, 4} = {(1, 3), (1, 4), (2, 3), (2, 4)} and, in contrast: {3, 4} × {1, 2} = {(3, 1), (3, 2), (4, 1), (4, 2)} Also demonstrate, using y...
#Action.21
Action!
DEFINE MAX_COUNT="10" DEFINE MAX_RESULT="100"   DEFINE PTR="CARD"   PROC PrintInput(PTR ARRAY a INT count) INT i,j,n INT ARRAY tmp   FOR i=0 TO count-1 DO tmp=a(i) n=tmp(0) Put('[) FOR j=1 TO n DO PrintI(tmp(j)) IF j<n THEN Put(',) FI OD Put(']) IF i<count-1 THEN Put('x) ...
http://rosettacode.org/wiki/Catamorphism
Catamorphism
Reduce is a function or method that is used to take the values in an array or a list and apply a function to successive members of the list to produce (or reduce them to), a single value. Task Show how reduce (or foldl or foldr etc), work (or would be implemented) in your language. See also Wikipedia article: ...
#AppleScript
AppleScript
---------------------- CATAMORPHISMS ---------------------   -- the arguments available to the called function f(a, x, i, l) are -- a: current accumulator value -- x: current item in list -- i: [ 1-based index in list ] optional -- l: [ a reference to the list itself ] optional   -- foldl :: (a -> b -> a) -> a -> [b] -...
http://rosettacode.org/wiki/Chaocipher
Chaocipher
Description The Chaocipher was invented by J.F.Byrne in 1918 and, although simple by modern cryptographic standards, does not appear to have been broken until the algorithm was finally disclosed by his family in 2010. The algorithm is described in this paper by M.Rubin in 2010 and there is a C# implementation here. ...
#Java
Java
import java.util.Arrays;   public class Chaocipher { private enum Mode { ENCRYPT, DECRYPT }   private static final String L_ALPHABET = "HXUCZVAMDSLKPEFJRIGTWOBNYQ"; private static final String R_ALPHABET = "PTLNBQDEOYSFAVZKGJRIHWXUMC";   private static int indexOf(char[] a, char c) {...
http://rosettacode.org/wiki/Catalan_numbers/Pascal%27s_triangle
Catalan numbers/Pascal's triangle
Task Print out the first   15   Catalan numbers by extracting them from Pascal's triangle. See   Catalan Numbers and the Pascal Triangle.     This method enables calculation of Catalan Numbers using only addition and subtraction.   Catalan's Triangle for a Number Triangle that generates Catalan Numbers using onl...
#Elixir
Elixir
defmodule Catalan do def numbers(num) do {result,_} = Enum.reduce(1..num, {[],{0,1}}, fn i,{list,t0} -> t1 = numbers(i, t0) t2 = numbers(i+1, Tuple.insert_at(t1, i+1, elem(t1, i))) {[elem(t2, i+1) - elem(t2, i) | list], t2} end) Enum.reverse(result) end   defp numbers(0, t), do: t ...
http://rosettacode.org/wiki/Catalan_numbers/Pascal%27s_triangle
Catalan numbers/Pascal's triangle
Task Print out the first   15   Catalan numbers by extracting them from Pascal's triangle. See   Catalan Numbers and the Pascal Triangle.     This method enables calculation of Catalan Numbers using only addition and subtraction.   Catalan's Triangle for a Number Triangle that generates Catalan Numbers using onl...
#Erlang
Erlang
  -module(catalin). -compile(export_all). mul(N,D,S,S)-> N2=N*(S+S), D2=D*S, K = N2 div D2 ; mul(N,D,S,L)-> N2=N*(S+L), D2=D*L, K = mul(N2,D2,S,L+1).   catl(Ans,16) -> Ans; catl(D,S)-> C=mul(1,1,S,2), catl([D|C],S+1). main()-> Ans=catl(1,2).  
http://rosettacode.org/wiki/Case-sensitivity_of_identifiers
Case-sensitivity of identifiers
Three dogs (Are there three dogs or one dog?) is a code snippet used to illustrate the lettercase sensitivity of the programming language. For a case-sensitive language, the identifiers dog, Dog and DOG are all different and we should get the output: The three dogs are named Benjamin, Samba and Bernie. For a language...
#Common_Lisp
Common Lisp
CL-USER> (let* ((dog "Benjamin") (Dog "Samba") (DOG "Bernie")) (format nil "There is just one dog named ~a." dog)) ; in: LAMBDA NIL ; (LET* ((DOG "Benjamin") (DOG "Samba") (DOG "Bernie")) ; (FORMAT NIL "There is just one dog named ~a." DOG)) ; ; caught STYLE-WARNING: ; The variable DOG is defined but n...
http://rosettacode.org/wiki/Case-sensitivity_of_identifiers
Case-sensitivity of identifiers
Three dogs (Are there three dogs or one dog?) is a code snippet used to illustrate the lettercase sensitivity of the programming language. For a case-sensitive language, the identifiers dog, Dog and DOG are all different and we should get the output: The three dogs are named Benjamin, Samba and Bernie. For a language...
#Crystal
Crystal
dog = "Benjamin" Dog = "Samba" DOG = "Bernie"   puts "The three dogs are named #{dog}, #{Dog} and #{DOG}."