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/String_length
String length
Task Find the character and byte length of a string. This means encodings like UTF-8 need to be handled properly, as there is not necessarily a one-to-one relationship between bytes and characters. By character, we mean an individual Unicode code point, not a user-visible grapheme containing combining characters. F...
#VBScript
VBScript
LenB(string|varname)
http://rosettacode.org/wiki/String_length
String length
Task Find the character and byte length of a string. This means encodings like UTF-8 need to be handled properly, as there is not necessarily a one-to-one relationship between bytes and characters. By character, we mean an individual Unicode code point, not a user-visible grapheme containing combining characters. F...
#Visual_Basic
Visual Basic
Module ByteLength Function GetByteLength(s As String, encoding As Text.Encoding) As Integer Return encoding.GetByteCount(s) End Function End Module
http://rosettacode.org/wiki/String_length
String length
Task Find the character and byte length of a string. This means encodings like UTF-8 need to be handled properly, as there is not necessarily a one-to-one relationship between bytes and characters. By character, we mean an individual Unicode code point, not a user-visible grapheme containing combining characters. F...
#Visual_Basic_.NET
Visual Basic .NET
Module ByteLength Function GetByteLength(s As String, encoding As Text.Encoding) As Integer Return encoding.GetByteCount(s) End Function End Module
http://rosettacode.org/wiki/String_length
String length
Task Find the character and byte length of a string. This means encodings like UTF-8 need to be handled properly, as there is not necessarily a one-to-one relationship between bytes and characters. By character, we mean an individual Unicode code point, not a user-visible grapheme containing combining characters. F...
#Vlang
Vlang
fn main() { m := "møøse" u := "𝔘𝔫𝔦𝔠𝔬𝔡𝔢" j := "J̲o̲s̲é̲" println("$m.len $m ${m.bytes()}") println("$u.len $u ${u.bytes()}") println("$j.len $j ${j.bytes()}") }
http://rosettacode.org/wiki/String_length
String length
Task Find the character and byte length of a string. This means encodings like UTF-8 need to be handled properly, as there is not necessarily a one-to-one relationship between bytes and characters. By character, we mean an individual Unicode code point, not a user-visible grapheme containing combining characters. F...
#Wren
Wren
System.print("møøse".bytes.count) System.print("𝔘𝔫𝔦𝔠𝔬𝔡𝔢".bytes.count) System.print("J̲o̲s̲é̲".bytes.count)
http://rosettacode.org/wiki/String_length
String length
Task Find the character and byte length of a string. This means encodings like UTF-8 need to be handled properly, as there is not necessarily a one-to-one relationship between bytes and characters. By character, we mean an individual Unicode code point, not a user-visible grapheme containing combining characters. F...
#x86_Assembly
x86 Assembly
  .data string: .asciz "Test"   .text .globl main   main: pushl  %ebp movl  %esp, %ebp   pushl  %edi xorb  %al, %al movl $-1, %ecx movl $string, %edi cld repne scasb not  %ecx dec  %ecx popl  %edi   ...
http://rosettacode.org/wiki/String_length
String length
Task Find the character and byte length of a string. This means encodings like UTF-8 need to be handled properly, as there is not necessarily a one-to-one relationship between bytes and characters. By character, we mean an individual Unicode code point, not a user-visible grapheme containing combining characters. F...
#XPL0
XPL0
include c:\cxpl\stdlib; IntOut(0, StrLen("Character length = Byte length = String length = "))
http://rosettacode.org/wiki/String_length
String length
Task Find the character and byte length of a string. This means encodings like UTF-8 need to be handled properly, as there is not necessarily a one-to-one relationship between bytes and characters. By character, we mean an individual Unicode code point, not a user-visible grapheme containing combining characters. F...
#XSLT
XSLT
<?xml version="1.0" encoding="UTF-8"?>
http://rosettacode.org/wiki/String_length
String length
Task Find the character and byte length of a string. This means encodings like UTF-8 need to be handled properly, as there is not necessarily a one-to-one relationship between bytes and characters. By character, we mean an individual Unicode code point, not a user-visible grapheme containing combining characters. F...
#xTalk
xTalk
put the length of "Hello World"
http://rosettacode.org/wiki/String_length
String length
Task Find the character and byte length of a string. This means encodings like UTF-8 need to be handled properly, as there is not necessarily a one-to-one relationship between bytes and characters. By character, we mean an individual Unicode code point, not a user-visible grapheme containing combining characters. F...
#Yorick
Yorick
strlen("Hello, world!")
http://rosettacode.org/wiki/String_length
String length
Task Find the character and byte length of a string. This means encodings like UTF-8 need to be handled properly, as there is not necessarily a one-to-one relationship between bytes and characters. By character, we mean an individual Unicode code point, not a user-visible grapheme containing combining characters. F...
#Z80_Assembly
Z80 Assembly
; input: HL - pointer to the 0th char of a string. ; outputs length to B. HL will point to the last character in the string just before the terminator. ; length is one-indexed and does not include the terminator. A null string will return 0 in B.   ; "Terminator" is a label for a constant that can be configured in the...
http://rosettacode.org/wiki/String_length
String length
Task Find the character and byte length of a string. This means encodings like UTF-8 need to be handled properly, as there is not necessarily a one-to-one relationship between bytes and characters. By character, we mean an individual Unicode code point, not a user-visible grapheme containing combining characters. F...
#zkl
zkl
"abc".len() //-->3 "\ufeff\u00A2 \u20ac".len() //-->9 "BOM¢ €"
http://rosettacode.org/wiki/String_length
String length
Task Find the character and byte length of a string. This means encodings like UTF-8 need to be handled properly, as there is not necessarily a one-to-one relationship between bytes and characters. By character, we mean an individual Unicode code point, not a user-visible grapheme containing combining characters. F...
#Zig
Zig
const std = @import("std");   pub fn main() !void { const string: []const u8 = "Hello, world!"; const cnt_codepts_utf8 = try std.unicode.utf8CountCodepoints(string); // There is no sane and portable extended ascii, so the best // we get is counting the bytes and assume regular ascii. const cnt_bytes...
http://rosettacode.org/wiki/Stirling_numbers_of_the_second_kind
Stirling numbers of the second kind
Stirling numbers of the second kind, or Stirling partition numbers, are the number of ways to partition a set of n objects into k non-empty subsets. They are closely related to Bell numbers, and may be derived from them. Stirling numbers of the second kind obey the recurrence relation: S2(n, 0) and S2(0, k) = 0 ...
#11l
11l
[(Int, Int) = BigInt] computed   F sterling2(n, k) V key = (n, k)   I key C :computed R :computed[key] I n == k == 0 R BigInt(1) I (n > 0 & k == 0) | (n == 0 & k > 0) R BigInt(0) I n == k R BigInt(1) I k > n R BigInt(0) V result = k * sterling2(n - 1, k) + sterling2(n ...
http://rosettacode.org/wiki/Stirling_numbers_of_the_second_kind
Stirling numbers of the second kind
Stirling numbers of the second kind, or Stirling partition numbers, are the number of ways to partition a set of n objects into k non-empty subsets. They are closely related to Bell numbers, and may be derived from them. Stirling numbers of the second kind obey the recurrence relation: S2(n, 0) and S2(0, k) = 0 ...
#ALGOL_68
ALGOL 68
BEGIN # show some Stirling numbers of the second kind #   # specify the precision of LONG LONG INT, somewhat under 160 digits are # # needed for Stirling numbers of the second kind with n, k = 100 # PR precision 160 PR MODE SINT = LONG LONG INT;   # returns a tr...
http://rosettacode.org/wiki/Stirling_numbers_of_the_second_kind
Stirling numbers of the second kind
Stirling numbers of the second kind, or Stirling partition numbers, are the number of ways to partition a set of n objects into k non-empty subsets. They are closely related to Bell numbers, and may be derived from them. Stirling numbers of the second kind obey the recurrence relation: S2(n, 0) and S2(0, k) = 0 ...
#ALGOL_W
ALGOL W
begin % show some Stirling numbers of the second kind  % integer MAX_STIRLING; MAX_STIRLING := 12; begin  % construct a matrix of Stirling numbers up to max n, max n  % integer array s2 ( 0 :: MAX_STIRLING, 0 :: MAX_STIRLING ); for n := 0 until MAX_STIR...
http://rosettacode.org/wiki/Stirling_numbers_of_the_second_kind
Stirling numbers of the second kind
Stirling numbers of the second kind, or Stirling partition numbers, are the number of ways to partition a set of n objects into k non-empty subsets. They are closely related to Bell numbers, and may be derived from them. Stirling numbers of the second kind obey the recurrence relation: S2(n, 0) and S2(0, k) = 0 ...
#BASIC
BASIC
10 DEFINT N,K: DEFDBL S: DEFSTR F 20 DIM S2(12,12),F(12) 30 FOR N=0 TO 12: READ F(N): NEXT N 40 S2(0,0)=1 50 FOR K=1 TO 12 60 FOR N=1 TO 12 70 IF N=K THEN S2(N,K)=1 ELSE S2(N,K)=K*S2(N-1,K)+S2(N-1,K-1) 80 NEXT N,K 90 FOR N=0 TO 12 100 FOR K=0 TO 12 110 IF N>=K THEN PRINT USING F(K);S2(N,K); 120 NEXT K 130 PRINT 140 NEX...
http://rosettacode.org/wiki/Stirling_numbers_of_the_second_kind
Stirling numbers of the second kind
Stirling numbers of the second kind, or Stirling partition numbers, are the number of ways to partition a set of n objects into k non-empty subsets. They are closely related to Bell numbers, and may be derived from them. Stirling numbers of the second kind obey the recurrence relation: S2(n, 0) and S2(0, k) = 0 ...
#C
C
#include <stdbool.h> #include <stdio.h> #include <stdlib.h>   typedef struct stirling_cache_tag { int max; int* values; } stirling_cache;   int stirling_number2(stirling_cache* sc, int n, int k) { if (k == n) return 1; if (k == 0 || k > n || n > sc->max) return 0; return sc->values[n...
http://rosettacode.org/wiki/Stirling_numbers_of_the_second_kind
Stirling numbers of the second kind
Stirling numbers of the second kind, or Stirling partition numbers, are the number of ways to partition a set of n objects into k non-empty subsets. They are closely related to Bell numbers, and may be derived from them. Stirling numbers of the second kind obey the recurrence relation: S2(n, 0) and S2(0, k) = 0 ...
#C.2B.2B
C++
#include <algorithm> #include <iomanip> #include <iostream> #include <map> #include <gmpxx.h>   using integer = mpz_class;   class stirling2 { public: integer get(int n, int k); private: std::map<std::pair<int, int>, integer> cache_; };   integer stirling2::get(int n, int k) { if (k == n) return 1; ...
http://rosettacode.org/wiki/Stirling_numbers_of_the_second_kind
Stirling numbers of the second kind
Stirling numbers of the second kind, or Stirling partition numbers, are the number of ways to partition a set of n objects into k non-empty subsets. They are closely related to Bell numbers, and may be derived from them. Stirling numbers of the second kind obey the recurrence relation: S2(n, 0) and S2(0, k) = 0 ...
#D
D
import std.bigint; import std.conv; import std.functional; import std.stdio;   alias sterling2 = memoize!sterling2Impl; BigInt sterling2Impl(int n, int k) { if (n == 0 && k == 0) { return BigInt(1); } if ((n > 0 && k == 0) || (n == 0 && k > 0)) { return BigInt(0); } if (n == k) { ...
http://rosettacode.org/wiki/Stirling_numbers_of_the_second_kind
Stirling numbers of the second kind
Stirling numbers of the second kind, or Stirling partition numbers, are the number of ways to partition a set of n objects into k non-empty subsets. They are closely related to Bell numbers, and may be derived from them. Stirling numbers of the second kind obey the recurrence relation: S2(n, 0) and S2(0, k) = 0 ...
#Factor
Factor
USING: combinators.short-circuit formatting io kernel math math.extras prettyprint sequences ; RENAME: stirling math.extras => (stirling) IN: rosetta-code.stirling-second   ! Tweak Factor's in-built stirling function for k=0 : stirling ( n k -- m ) 2dup { [ = not ] [ nip zero? ] } 2&& [ 2drop 0 ] [ (stirling) ]...
http://rosettacode.org/wiki/Stirling_numbers_of_the_second_kind
Stirling numbers of the second kind
Stirling numbers of the second kind, or Stirling partition numbers, are the number of ways to partition a set of n objects into k non-empty subsets. They are closely related to Bell numbers, and may be derived from them. Stirling numbers of the second kind obey the recurrence relation: S2(n, 0) and S2(0, k) = 0 ...
#FreeBASIC
FreeBASIC
dim as integer S2(0 to 12, 0 to 12) 'initially set with zeroes dim as ubyte n, k dim as string outstr   function padto( i as ubyte, j as integer ) as string return wspace(i-len(str(j)))+str(j) end function   for k = 0 to 12 'calculate table S2(k,k)=1 next k for n = 1 to 11 for k = 1 to 12 S2(n+1...
http://rosettacode.org/wiki/Stirling_numbers_of_the_second_kind
Stirling numbers of the second kind
Stirling numbers of the second kind, or Stirling partition numbers, are the number of ways to partition a set of n objects into k non-empty subsets. They are closely related to Bell numbers, and may be derived from them. Stirling numbers of the second kind obey the recurrence relation: S2(n, 0) and S2(0, k) = 0 ...
#F.C5.8Drmul.C3.A6
Fōrmulæ
package main   import ( "fmt" "math/big" )   func main() { limit := 100 last := 12 s2 := make([][]*big.Int, limit+1) for n := 0; n <= limit; n++ { s2[n] = make([]*big.Int, limit+1) for k := 0; k <= limit; k++ { s2[n][k] = new(big.Int) } s2[n][n].SetInt...
http://rosettacode.org/wiki/Stirling_numbers_of_the_second_kind
Stirling numbers of the second kind
Stirling numbers of the second kind, or Stirling partition numbers, are the number of ways to partition a set of n objects into k non-empty subsets. They are closely related to Bell numbers, and may be derived from them. Stirling numbers of the second kind obey the recurrence relation: S2(n, 0) and S2(0, k) = 0 ...
#Go
Go
package main   import ( "fmt" "math/big" )   func main() { limit := 100 last := 12 s2 := make([][]*big.Int, limit+1) for n := 0; n <= limit; n++ { s2[n] = make([]*big.Int, limit+1) for k := 0; k <= limit; k++ { s2[n][k] = new(big.Int) } s2[n][n].SetInt...
http://rosettacode.org/wiki/Stirling_numbers_of_the_second_kind
Stirling numbers of the second kind
Stirling numbers of the second kind, or Stirling partition numbers, are the number of ways to partition a set of n objects into k non-empty subsets. They are closely related to Bell numbers, and may be derived from them. Stirling numbers of the second kind obey the recurrence relation: S2(n, 0) and S2(0, k) = 0 ...
#Haskell
Haskell
import Text.Printf (printf) import Data.List (groupBy) import qualified Data.MemoCombinators as Memo   stirling2 :: Integral a => (a, a) -> a stirling2 = Memo.pair Memo.integral Memo.integral f where f (n, k) | n == 0 && k == 0 = 1 | (n > 0 && k == 0) || (n == 0 && k > 0) = 0 | n == k = 1 ...
http://rosettacode.org/wiki/Stirling_numbers_of_the_second_kind
Stirling numbers of the second kind
Stirling numbers of the second kind, or Stirling partition numbers, are the number of ways to partition a set of n objects into k non-empty subsets. They are closely related to Bell numbers, and may be derived from them. Stirling numbers of the second kind obey the recurrence relation: S2(n, 0) and S2(0, k) = 0 ...
#J
J
test=: 1 i.~ (0 = *) , = s2=: 0:`1:`($:&<: + ] * <:@:[ $: ])@.test M. s2&>table i. 13 +----+--------------------------------------------------------------------+ |s2&>|0 1 2 3 4 5 6 7 8 9 10 11 12| +----+------------------------------------------------------------------...
http://rosettacode.org/wiki/Stirling_numbers_of_the_second_kind
Stirling numbers of the second kind
Stirling numbers of the second kind, or Stirling partition numbers, are the number of ways to partition a set of n objects into k non-empty subsets. They are closely related to Bell numbers, and may be derived from them. Stirling numbers of the second kind obey the recurrence relation: S2(n, 0) and S2(0, k) = 0 ...
#Java
Java
  import java.math.BigInteger; import java.util.HashMap; import java.util.Map;   public class SterlingNumbersSecondKind {   public static void main(String[] args) { System.out.println("Stirling numbers of the second kind:"); int max = 12; System.out.printf("n/k"); for ( int n = 0 ; n...
http://rosettacode.org/wiki/Stirling_numbers_of_the_second_kind
Stirling numbers of the second kind
Stirling numbers of the second kind, or Stirling partition numbers, are the number of ways to partition a set of n objects into k non-empty subsets. They are closely related to Bell numbers, and may be derived from them. Stirling numbers of the second kind obey the recurrence relation: S2(n, 0) and S2(0, k) = 0 ...
#jq
jq
def lpad($len): tostring | ($len - length) as $l | (" " * $l)[:$l] + .;   # Input: {computed} (the cache) # Output: {computed, result} def stirling2($n; $k): "\($n),\($k)" as $key | if .computed[$key] then .result = .computed[$key] elif ($n == 0 and $k == 0) then .result = 1 elif (($n > 0 and $k == 0) or (...
http://rosettacode.org/wiki/Stirling_numbers_of_the_second_kind
Stirling numbers of the second kind
Stirling numbers of the second kind, or Stirling partition numbers, are the number of ways to partition a set of n objects into k non-empty subsets. They are closely related to Bell numbers, and may be derived from them. Stirling numbers of the second kind obey the recurrence relation: S2(n, 0) and S2(0, k) = 0 ...
#Julia
Julia
using Combinatorics   const s2cache = Dict()   function stirlings2(n, k) if haskey(s2cache, Pair(n, k)) return s2cache[Pair(n, k)] elseif n < 0 throw(DomainError(n, "n must be nonnegative")) elseif n == k == 0 return one(n) elseif n == 0 || k == 0 return zero(n) elsei...
http://rosettacode.org/wiki/Strassen%27s_algorithm
Strassen's algorithm
Description In linear algebra, the Strassen algorithm   (named after Volker Strassen),   is an algorithm for matrix multiplication. It is faster than the standard matrix multiplication algorithm and is useful in practice for large matrices,   but would be slower than the fastest known algorithms for extremely large ma...
#Go
Go
package main   import ( "fmt" "log" "math" )   type Matrix [][]float64   func (m Matrix) rows() int { return len(m) } func (m Matrix) cols() int { return len(m[0]) }   func (m Matrix) add(m2 Matrix) Matrix { if m.rows() != m2.rows() || m.cols() != m2.cols() { log.Fatal("Matrices must have the sa...
http://rosettacode.org/wiki/String_append
String append
Basic Data Operation This is a basic data operation. It represents a fundamental action on a basic data type. You may see other such operations in the Basic Data Operations category, or: Integer Operations Arithmetic | Comparison Boolean Operations Bitwise | Logical String Operations Concatenation | Interpolation |...
#11l
11l
V s = ‘12345678’ s ‘’= ‘9!’ print(s)
http://rosettacode.org/wiki/Stirling_numbers_of_the_second_kind
Stirling numbers of the second kind
Stirling numbers of the second kind, or Stirling partition numbers, are the number of ways to partition a set of n objects into k non-empty subsets. They are closely related to Bell numbers, and may be derived from them. Stirling numbers of the second kind obey the recurrence relation: S2(n, 0) and S2(0, k) = 0 ...
#Kotlin
Kotlin
import java.math.BigInteger   fun main() { println("Stirling numbers of the second kind:") val max = 12 print("n/k") for (n in 0..max) { print("%10d".format(n)) } println() for (n in 0..max) { print("%-3d".format(n)) for (k in 0..n) { print("%10s".format(s...
http://rosettacode.org/wiki/Strassen%27s_algorithm
Strassen's algorithm
Description In linear algebra, the Strassen algorithm   (named after Volker Strassen),   is an algorithm for matrix multiplication. It is faster than the standard matrix multiplication algorithm and is useful in practice for large matrices,   but would be slower than the fastest known algorithms for extremely large ma...
#Julia
Julia
""" Strassen's matrix multiplication algorithm. Use dynamic padding in order to reduce required auxiliary memory. """ function strassen(x::Matrix, y::Matrix) # Check that the sizes of these matrices match. (r1, c1) = size(x) (r2, c2) = size(y) if c1 != r2 error("Multiplying $r1 x $c1 and $r2 x $...
http://rosettacode.org/wiki/Strassen%27s_algorithm
Strassen's algorithm
Description In linear algebra, the Strassen algorithm   (named after Volker Strassen),   is an algorithm for matrix multiplication. It is faster than the standard matrix multiplication algorithm and is useful in practice for large matrices,   but would be slower than the fastest known algorithms for extremely large ma...
#Nim
Nim
import math, sequtils, strutils   type Matrix = seq[seq[float]]   template rows(m: Matrix): Positive = m.len template cols(m: Matrix): Positive = m[0].len     func `+`(m1, m2: Matrix): Matrix = doAssert m1.rows == m2.rows and m1.cols == m2.cols, "Matrices must have the same dimensions." result = newSeqWith(m1.rows,...
http://rosettacode.org/wiki/String_append
String append
Basic Data Operation This is a basic data operation. It represents a fundamental action on a basic data type. You may see other such operations in the Basic Data Operations category, or: Integer Operations Arithmetic | Comparison Boolean Operations Bitwise | Logical String Operations Concatenation | Interpolation |...
#AArch64_Assembly
AArch64 Assembly
  /* ARM assembly AARCH64 Raspberry PI 3B */ /* program appendstr64.s */   /*******************************************/ /* Constantes file */ /*******************************************/ /* for this file see task include a file in language AArch64 assembly*/ .include "../includeConstantesAR...
http://rosettacode.org/wiki/String_append
String append
Basic Data Operation This is a basic data operation. It represents a fundamental action on a basic data type. You may see other such operations in the Basic Data Operations category, or: Integer Operations Arithmetic | Comparison Boolean Operations Bitwise | Logical String Operations Concatenation | Interpolation |...
#Action.21
Action!
  CHAR ARRAY S1,S2   Proc Main() S1="Hello, " S2="world!"; Sassign(S1,S2,S1(0)+1) Print(S1) Return  
http://rosettacode.org/wiki/Stirling_numbers_of_the_second_kind
Stirling numbers of the second kind
Stirling numbers of the second kind, or Stirling partition numbers, are the number of ways to partition a set of n objects into k non-empty subsets. They are closely related to Bell numbers, and may be derived from them. Stirling numbers of the second kind obey the recurrence relation: S2(n, 0) and S2(0, k) = 0 ...
#Mathematica_.2F_Wolfram_Language
Mathematica / Wolfram Language
TableForm[Array[StirlingS2, {n = 12, k = 12} + 1, {0, 0}], TableHeadings -> {"n=" <> ToString[#] & /@ Range[0, n], "k=" <> ToString[#] & /@ Range[0, k]}] Max[Abs[StirlingS2[100, #]] & /@ Range[0, 100]]
http://rosettacode.org/wiki/Strassen%27s_algorithm
Strassen's algorithm
Description In linear algebra, the Strassen algorithm   (named after Volker Strassen),   is an algorithm for matrix multiplication. It is faster than the standard matrix multiplication algorithm and is useful in practice for large matrices,   but would be slower than the fastest known algorithms for extremely large ma...
#Phix
Phix
with javascript_semantics function strassen(sequence a, b) integer l = length(a) if length(a[1])!=l or length(b)!=l or length(b[1])!=l then crash("two equal square matrices only") end if if l=1 then return sq_mul(a,b) end if if remainder(l,1) then crash("2^n matrices only") ...
http://rosettacode.org/wiki/String_append
String append
Basic Data Operation This is a basic data operation. It represents a fundamental action on a basic data type. You may see other such operations in the Basic Data Operations category, or: Integer Operations Arithmetic | Comparison Boolean Operations Bitwise | Logical String Operations Concatenation | Interpolation |...
#Ada
Ada
  with Ada.Strings.Unbounded; use Ada.Strings.Unbounded; with Ada.Text_IO.Unbounded_Io; use Ada.Text_IO.Unbounded_IO;   procedure String_Append is Str : Unbounded_String := To_Unbounded_String("Hello"); begin Append(Str, ", world!"); Put_Line(Str); end String_Append;  
http://rosettacode.org/wiki/String_append
String append
Basic Data Operation This is a basic data operation. It represents a fundamental action on a basic data type. You may see other such operations in the Basic Data Operations category, or: Integer Operations Arithmetic | Comparison Boolean Operations Bitwise | Logical String Operations Concatenation | Interpolation |...
#ALGOL_68
ALGOL 68
#!/usr/bin/a68g --script # # -*- coding: utf-8 -*- #   STRING str := "12345678"; str +:= "9!"; print(str)
http://rosettacode.org/wiki/Stirling_numbers_of_the_second_kind
Stirling numbers of the second kind
Stirling numbers of the second kind, or Stirling partition numbers, are the number of ways to partition a set of n objects into k non-empty subsets. They are closely related to Bell numbers, and may be derived from them. Stirling numbers of the second kind obey the recurrence relation: S2(n, 0) and S2(0, k) = 0 ...
#Nim
Nim
import sequtils, strutils   proc s2(n, k: Natural): Natural = if n == k: return 1 if n == 0 or k == 0: return 0 k * s2(n - 1, k) + s2(n - 1, k - 1)   echo " k ", toSeq(0..12).mapIt(($it).align(2)).join(" ") echo " n" for n in 0..12: stdout.write ($n).align(2) for k in 0..n: stdout.write ($s2(n, ...
http://rosettacode.org/wiki/Stirling_numbers_of_the_second_kind
Stirling numbers of the second kind
Stirling numbers of the second kind, or Stirling partition numbers, are the number of ways to partition a set of n objects into k non-empty subsets. They are closely related to Bell numbers, and may be derived from them. Stirling numbers of the second kind obey the recurrence relation: S2(n, 0) and S2(0, k) = 0 ...
#Perl
Perl
use strict; use warnings; use bigint; use feature 'say'; use feature 'state'; no warnings 'recursion'; use List::Util qw(max);   sub Stirling2 { my($n, $k) = @_; my $n1 = $n - 1; return 1 if $n1 == $k; return 0 unless $n1 && $k; state %seen; return ($seen{"{$n1}|{$k}" } //= Stirling2($n1,$k...
http://rosettacode.org/wiki/Strassen%27s_algorithm
Strassen's algorithm
Description In linear algebra, the Strassen algorithm   (named after Volker Strassen),   is an algorithm for matrix multiplication. It is faster than the standard matrix multiplication algorithm and is useful in practice for large matrices,   but would be slower than the fastest known algorithms for extremely large ma...
#Python
Python
"""Matrix multiplication using Strassen's algorithm. Requires Python >= 3.7."""   from __future__ import annotations from itertools import chain from typing import List from typing import NamedTuple from typing import Optional     class Shape(NamedTuple): rows: int cols: int     class Matrix(List): """A mat...
http://rosettacode.org/wiki/String_append
String append
Basic Data Operation This is a basic data operation. It represents a fundamental action on a basic data type. You may see other such operations in the Basic Data Operations category, or: Integer Operations Arithmetic | Comparison Boolean Operations Bitwise | Logical String Operations Concatenation | Interpolation |...
#ARM_Assembly
ARM Assembly
  /* ARM assembly Raspberry PI */ /* program appendstr.s */   /* Constantes */ .equ STDOUT, 1 @ Linux output console .equ EXIT, 1 @ Linux syscall .equ WRITE, 4 @ Linux syscall   .equ BUFFERSIZE, 100   /* Initialized data */...
http://rosettacode.org/wiki/Stirling_numbers_of_the_second_kind
Stirling numbers of the second kind
Stirling numbers of the second kind, or Stirling partition numbers, are the number of ways to partition a set of n objects into k non-empty subsets. They are closely related to Bell numbers, and may be derived from them. Stirling numbers of the second kind obey the recurrence relation: S2(n, 0) and S2(0, k) = 0 ...
#Phix
Phix
with javascript_semantics include mpfr.e constant lim = 100, lim1 = lim+1, last = 12 sequence s2 = repeat(0,lim1) for n=1 to lim1 do s2[n] = mpz_inits(lim1) mpz_set_si(s2[n][n],1) end for mpz {t, m100} = mpz_inits(2) for n=1 to lim do for k=1 to n do mpz_set_si(t,k) mpz_...
http://rosettacode.org/wiki/Strassen%27s_algorithm
Strassen's algorithm
Description In linear algebra, the Strassen algorithm   (named after Volker Strassen),   is an algorithm for matrix multiplication. It is faster than the standard matrix multiplication algorithm and is useful in practice for large matrices,   but would be slower than the fastest known algorithms for extremely large ma...
#Raku
Raku
# 20210126 Raku programming solution   use Math::Libgsl::Constants; use Math::Libgsl::Matrix; use Math::Libgsl::BLAS;   my @M;   sub SQM (\in) { # create custom sq matrix from CSV die "Not a ■" if (my \L = in.split(/\,/)).sqrt != (my \size = L.sqrt.Int); my Math::Libgsl::Matrix \M .= new: size, size; for ^siz...
http://rosettacode.org/wiki/String_append
String append
Basic Data Operation This is a basic data operation. It represents a fundamental action on a basic data type. You may see other such operations in the Basic Data Operations category, or: Integer Operations Arithmetic | Comparison Boolean Operations Bitwise | Logical String Operations Concatenation | Interpolation |...
#AppleScript
AppleScript
  set {a, b} to {"Apple", "Script"} set a to a & b return a as string  
http://rosettacode.org/wiki/String_append
String append
Basic Data Operation This is a basic data operation. It represents a fundamental action on a basic data type. You may see other such operations in the Basic Data Operations category, or: Integer Operations Arithmetic | Comparison Boolean Operations Bitwise | Logical String Operations Concatenation | Interpolation |...
#APL
APL
s←'hello' s,'world' helloworld
http://rosettacode.org/wiki/Stirling_numbers_of_the_second_kind
Stirling numbers of the second kind
Stirling numbers of the second kind, or Stirling partition numbers, are the number of ways to partition a set of n objects into k non-empty subsets. They are closely related to Bell numbers, and may be derived from them. Stirling numbers of the second kind obey the recurrence relation: S2(n, 0) and S2(0, k) = 0 ...
#Prolog
Prolog
:- dynamic stirling2_cache/3.   stirling2(N, N, 1):-!. stirling2(_, 0, 0):-!. stirling2(N, K, 0):- K > N, !. stirling2(N, K, L):- stirling2_cache(N, K, L), !. stirling2(N, K, L):- N1 is N - 1, K1 is K - 1, stirling2(N1, K, L1), stirling2(N1, K1, L2), !, L is K * L1 + L2, assertz(stirling2_cache(N, K, L)).   ...
http://rosettacode.org/wiki/Strassen%27s_algorithm
Strassen's algorithm
Description In linear algebra, the Strassen algorithm   (named after Volker Strassen),   is an algorithm for matrix multiplication. It is faster than the standard matrix multiplication algorithm and is useful in practice for large matrices,   but would be slower than the fastest known algorithms for extremely large ma...
#Swift
Swift
  // Matrix Strassen Multiplication func strassenMultiply(matrix1: Matrix, matrix2: Matrix) -> Matrix { precondition(matrix1.columns == matrix2.columns, "Two matrices can only be matrix multiplied if one has dimensions mxn & the other has dimensions nxp where m, n, p are in R")   // Transform to sq...
http://rosettacode.org/wiki/Strassen%27s_algorithm
Strassen's algorithm
Description In linear algebra, the Strassen algorithm   (named after Volker Strassen),   is an algorithm for matrix multiplication. It is faster than the standard matrix multiplication algorithm and is useful in practice for large matrices,   but would be slower than the fastest known algorithms for extremely large ma...
#Wren
Wren
class Matrix { construct new(a) { if (a.type != List || a.count == 0 || a[0].type != List || a[0].count == 0 || a[0][0].type != Num) { Fiber.abort("Argument must be a non-empty two dimensional list of numbers.") } _a = a }   rows { _a.count } cols { _a[0].count } ...
http://rosettacode.org/wiki/String_append
String append
Basic Data Operation This is a basic data operation. It represents a fundamental action on a basic data type. You may see other such operations in the Basic Data Operations category, or: Integer Operations Arithmetic | Comparison Boolean Operations Bitwise | Logical String Operations Concatenation | Interpolation |...
#Arturo
Arturo
print join ["Hello" "World"]   a: new "Hello" 'a ++ "World" print a   b: new "Hello" append 'b "World" print b   c: "Hello" print append c "World"
http://rosettacode.org/wiki/String_append
String append
Basic Data Operation This is a basic data operation. It represents a fundamental action on a basic data type. You may see other such operations in the Basic Data Operations category, or: Integer Operations Arithmetic | Comparison Boolean Operations Bitwise | Logical String Operations Concatenation | Interpolation |...
#Asymptote
Asymptote
string s = "Hello"; s = s + " Wo"; s += "rld!"; write(s);
http://rosettacode.org/wiki/Stirling_numbers_of_the_second_kind
Stirling numbers of the second kind
Stirling numbers of the second kind, or Stirling partition numbers, are the number of ways to partition a set of n objects into k non-empty subsets. They are closely related to Bell numbers, and may be derived from them. Stirling numbers of the second kind obey the recurrence relation: S2(n, 0) and S2(0, k) = 0 ...
#Python
Python
  computed = {}   def sterling2(n, k): key = str(n) + "," + str(k)   if key in computed.keys(): return computed[key] if n == k == 0: return 1 if (n > 0 and k == 0) or (n == 0 and k > 0): return 0 if n == k: return 1 if k > n: return 0 result = k * sterling2(n - 1, k) + sterling2(n - 1, k - 1) computed...
http://rosettacode.org/wiki/String_append
String append
Basic Data Operation This is a basic data operation. It represents a fundamental action on a basic data type. You may see other such operations in the Basic Data Operations category, or: Integer Operations Arithmetic | Comparison Boolean Operations Bitwise | Logical String Operations Concatenation | Interpolation |...
#AutoHotkey
AutoHotkey
s := "Hello, " s .= "world." MsgBox % s
http://rosettacode.org/wiki/String_append
String append
Basic Data Operation This is a basic data operation. It represents a fundamental action on a basic data type. You may see other such operations in the Basic Data Operations category, or: Integer Operations Arithmetic | Comparison Boolean Operations Bitwise | Logical String Operations Concatenation | Interpolation |...
#Avail
Avail
str : string := "99 bottles of "; str ++= "beer"; Print: str;
http://rosettacode.org/wiki/Stirling_numbers_of_the_second_kind
Stirling numbers of the second kind
Stirling numbers of the second kind, or Stirling partition numbers, are the number of ways to partition a set of n objects into k non-empty subsets. They are closely related to Bell numbers, and may be derived from them. Stirling numbers of the second kind obey the recurrence relation: S2(n, 0) and S2(0, k) = 0 ...
#Quackery
Quackery
[ dip number$ over size - space swap of swap join echo$ ] is justify ( n n --> )   [ table ] is s2table ( n --> n )   [ swap 101 * + s2table ] is s2 ( n n --> n )   101 times [ i^ 101 times [ dup i^ [ 2dup = iff [ 2drop 1 ] done ...
http://rosettacode.org/wiki/Straddling_checkerboard
Straddling checkerboard
Task Implement functions to encrypt and decrypt a message using the straddling checkerboard method. The checkerboard should take a 28 character alphabet (A-Z plus a full stop and an escape character) and two different numbers representing the blanks in the first row. The output will be a series of decimal digits. Num...
#11l
11l
V t = [[String(‘79’), ‘0’, ‘1’, ‘2’, ‘3’, ‘4’, ‘5’, ‘6’, ‘7’, ‘8’, ‘9’], [String(‘’), ‘H’, ‘O’, ‘L’, ‘’, ‘M’, ‘E’, ‘S’, ‘’, ‘R’, ‘T’], [String(‘3’), ‘A’, ‘B’, ‘C’, ‘D’, ‘F’, ‘G’, ‘I’, ‘J’, ‘K’, ‘N’], [String(‘7’), ‘P’, ‘Q’, ‘U’, ‘V’, ‘W’, ‘X’, ‘Y’, ‘Z’, ‘.’, ‘/’]]   F straddle(s) R multilo...
http://rosettacode.org/wiki/String_append
String append
Basic Data Operation This is a basic data operation. It represents a fundamental action on a basic data type. You may see other such operations in the Basic Data Operations category, or: Integer Operations Arithmetic | Comparison Boolean Operations Bitwise | Logical String Operations Concatenation | Interpolation |...
#AWK
AWK
  # syntax: GAWK -f STRING_APPEND.AWK BEGIN { s = "foo" s = s "bar" print(s) exit(0) }  
http://rosettacode.org/wiki/String_append
String append
Basic Data Operation This is a basic data operation. It represents a fundamental action on a basic data type. You may see other such operations in the Basic Data Operations category, or: Integer Operations Arithmetic | Comparison Boolean Operations Bitwise | Logical String Operations Concatenation | Interpolation |...
#Axe
Axe
Lbl STRCAT Copy(r₂,r₁+length(r₁),length(r₂)+1) r₁ Return
http://rosettacode.org/wiki/Stirling_numbers_of_the_second_kind
Stirling numbers of the second kind
Stirling numbers of the second kind, or Stirling partition numbers, are the number of ways to partition a set of n objects into k non-empty subsets. They are closely related to Bell numbers, and may be derived from them. Stirling numbers of the second kind obey the recurrence relation: S2(n, 0) and S2(0, k) = 0 ...
#Raku
Raku
sub Stirling2 (Int \n, Int \k) { ((1,), { (0, |@^last) »+« (|(@^last »*« @^last.keys), 0) } … *)[n;k] }   my $upto = 12;   my $mx = (1..^$upto).map( { Stirling2($upto, $_) } ).max.chars;   put 'Stirling numbers of the second kind: S2(n, k):'; put 'n\k', (0..$upto)».fmt: "%{$mx}d";   for 0..$upto -> $row { $row....
http://rosettacode.org/wiki/Straddling_checkerboard
Straddling checkerboard
Task Implement functions to encrypt and decrypt a message using the straddling checkerboard method. The checkerboard should take a 28 character alphabet (A-Z plus a full stop and an escape character) and two different numbers representing the blanks in the first row. The output will be a series of decimal digits. Num...
#ALGOL_68
ALGOL 68
#!/usr/local/bin/a68g --script #   PRIO MIN=5, MAX=5; OP MIN = (INT a, b)INT: (a<b|a|b), MAX = (INT a, b)INT: (a>b|a|b);   MODE STRADDLINGCHECKERBOARD=STRUCT( [0:9]CHAR first, second, third, [ABS ".": ABS "Z"]STRING table, INT row u, row v, CHAR esc, skip );   STRUCT( PROC (REF STRADDLINGCHECKERBOARD #self...
http://rosettacode.org/wiki/String_append
String append
Basic Data Operation This is a basic data operation. It represents a fundamental action on a basic data type. You may see other such operations in the Basic Data Operations category, or: Integer Operations Arithmetic | Comparison Boolean Operations Bitwise | Logical String Operations Concatenation | Interpolation |...
#BASIC
BASIC
S$ = "Hello" S$ = S$ + " World!" PRINT S$
http://rosettacode.org/wiki/String_append
String append
Basic Data Operation This is a basic data operation. It represents a fundamental action on a basic data type. You may see other such operations in the Basic Data Operations category, or: Integer Operations Arithmetic | Comparison Boolean Operations Bitwise | Logical String Operations Concatenation | Interpolation |...
#Bracmat
Bracmat
str="Hello"; str$(!str " World!"):?str; out$!str;
http://rosettacode.org/wiki/Stirling_numbers_of_the_second_kind
Stirling numbers of the second kind
Stirling numbers of the second kind, or Stirling partition numbers, are the number of ways to partition a set of n objects into k non-empty subsets. They are closely related to Bell numbers, and may be derived from them. Stirling numbers of the second kind obey the recurrence relation: S2(n, 0) and S2(0, k) = 0 ...
#REXX
REXX
/*REXX program to compute and display Stirling numbers of the second kind. */ parse arg lim . /*obtain optional argument from the CL.*/ if lim=='' | lim=="," then lim= 12 /*Not specified? Then use the default.*/ olim= lim ...
http://rosettacode.org/wiki/Straddling_checkerboard
Straddling checkerboard
Task Implement functions to encrypt and decrypt a message using the straddling checkerboard method. The checkerboard should take a 28 character alphabet (A-Z plus a full stop and an escape character) and two different numbers representing the blanks in the first row. The output will be a series of decimal digits. Num...
#AutoHotkey
AutoHotkey
board := " ( ET AON RIS BCDFGHJKLM PQ/UVWXYZ. )" Text = One night-it was on the twentieth of March, 1888-I was returning StringUpper, Text, Text Text := RegExReplace(text, "[^A-Z0-9]") Num2 := InStr(board, A_Space) -1 Num3 := InStr(board, A_Space, true, Num1+1) -1 Loop Parse, Text { char := A_LoopField ...
http://rosettacode.org/wiki/Stirling_numbers_of_the_first_kind
Stirling numbers of the first kind
Stirling numbers of the first kind, or Stirling cycle numbers, count permutations according to their number of cycles (counting fixed points as cycles of length one). They may be defined directly to be the number of permutations of n elements with k disjoint cycles. Stirling numbers of the first kind express coeffici...
#11l
11l
[(Int, Int) = BigInt] computed   F sterling1(n, k) V key = (n, k)   I key C :computed R :computed[key] I n == k == 0 R BigInt(1) I n > 0 & k == 0 R BigInt(0) I k > n R BigInt(0) V result = sterling1(n - 1, k - 1) + (n - 1) * sterling1(n - 1, k)  :computed[key] = result R r...
http://rosettacode.org/wiki/String_append
String append
Basic Data Operation This is a basic data operation. It represents a fundamental action on a basic data type. You may see other such operations in the Basic Data Operations category, or: Integer Operations Arithmetic | Comparison Boolean Operations Bitwise | Logical String Operations Concatenation | Interpolation |...
#C
C
#include<stdio.h> #include<string.h>   int main() { char str[24]="Good Morning"; char *cstr=" to all"; char *cstr2=" !!!"; int x=0; //failure when space allocated to str is insufficient.   if(sizeof(str)>strlen(str)+strlen(cstr)+strlen(cstr2)) { /* 1st method*/ ...
http://rosettacode.org/wiki/Stirling_numbers_of_the_second_kind
Stirling numbers of the second kind
Stirling numbers of the second kind, or Stirling partition numbers, are the number of ways to partition a set of n objects into k non-empty subsets. They are closely related to Bell numbers, and may be derived from them. Stirling numbers of the second kind obey the recurrence relation: S2(n, 0) and S2(0, k) = 0 ...
#Ruby
Ruby
@memo = {}   def sterling2(n, k) key = [n,k] return @memo[key] if @memo.key?(key) return 1 if n.zero? and k.zero? return 0 if n.zero? or k.zero? return 1 if n == k return 0 if k > n res = k * sterling2(n-1, k) + sterling2(n - 1, k-1) @memo[key] = res end   r = (0..12) puts "Sterling2 numbers:" puts "n/...
http://rosettacode.org/wiki/Straddling_checkerboard
Straddling checkerboard
Task Implement functions to encrypt and decrypt a message using the straddling checkerboard method. The checkerboard should take a 28 character alphabet (A-Z plus a full stop and an escape character) and two different numbers representing the blanks in the first row. The output will be a series of decimal digits. Num...
#C
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <stdbool.h> #include <ctype.h> #include <glib.h>   #define ROWS 4 #define COLS 10 #define NPRX "/"   /* wikipedia table const char *table[ROWS][COLS] = { { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9" }, { "E", "T", NULL, "A", "O", "N", N...
http://rosettacode.org/wiki/Stirling_numbers_of_the_first_kind
Stirling numbers of the first kind
Stirling numbers of the first kind, or Stirling cycle numbers, count permutations according to their number of cycles (counting fixed points as cycles of length one). They may be defined directly to be the number of permutations of n elements with k disjoint cycles. Stirling numbers of the first kind express coeffici...
#ALGOL_68
ALGOL 68
BEGIN # show some (unsigned) Stirling numbers of the first kind #   # specify the precision of LONG LONG INT, we need about 160 digits # # for Stirling numbers of the first kind with n, k = 100 # PR precision 160 PR MODE SINT = LONG LONG INT;   # returns a triangular mat...
http://rosettacode.org/wiki/String_append
String append
Basic Data Operation This is a basic data operation. It represents a fundamental action on a basic data type. You may see other such operations in the Basic Data Operations category, or: Integer Operations Arithmetic | Comparison Boolean Operations Bitwise | Logical String Operations Concatenation | Interpolation |...
#C.23
C#
class Program { static void Main(string[] args) { string x = "foo"; x += "bar"; System.Console.WriteLine(x); } }
http://rosettacode.org/wiki/String_append
String append
Basic Data Operation This is a basic data operation. It represents a fundamental action on a basic data type. You may see other such operations in the Basic Data Operations category, or: Integer Operations Arithmetic | Comparison Boolean Operations Bitwise | Logical String Operations Concatenation | Interpolation |...
#C.2B.2B
C++
#include <iostream> #include <string>   int main( ) { std::string greeting( "Hello" ) ; greeting.append( " , world!" ) ; std::cout << greeting << std::endl ; return 0 ; }
http://rosettacode.org/wiki/Stream_merge
Stream merge
2-stream merge Read two sorted streams of items from external source (e.g. disk, or network), and write one stream of sorted items to external sink. Common algorithm: keep 1 buffered item from each source, select minimal of them, write it, fetch another item from that stream from which the written item was. N-strea...
#360_Assembly
360 Assembly
* Stream Merge 07/02/2017 STRMERGE CSECT USING STRMERGE,R13 base register B 72(R15) skip savearea DC 17F'0' savearea STM R14,R12,12(R13) prolog ST R13,4(R15) " <- ST R15,8(R13) ...
http://rosettacode.org/wiki/Stirling_numbers_of_the_second_kind
Stirling numbers of the second kind
Stirling numbers of the second kind, or Stirling partition numbers, are the number of ways to partition a set of n objects into k non-empty subsets. They are closely related to Bell numbers, and may be derived from them. Stirling numbers of the second kind obey the recurrence relation: S2(n, 0) and S2(0, k) = 0 ...
#Sidef
Sidef
func S2(n, k) { # Stirling numbers of the second kind stirling2(n, k) }   const r = (0..12)   var triangle = r.map {|n| 0..n -> map {|k| S2(n, k) } } var widths = r.map {|n| r.map {|k| (triangle[k][n] \\ 0).len }.max }   say ('n\k ', r.map {|n| "%*s" % (widths[n], n) }.join(' '))   r.each {|n| var str = (...
http://rosettacode.org/wiki/Straddling_checkerboard
Straddling checkerboard
Task Implement functions to encrypt and decrypt a message using the straddling checkerboard method. The checkerboard should take a 28 character alphabet (A-Z plus a full stop and an escape character) and two different numbers representing the blanks in the first row. The output will be a series of decimal digits. Num...
#C.23
C#
using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions;   namespace StraddlingCheckerboard { class Program { public readonly static IReadOnlyDictionary<char, string> val2Key; public readonly static IReadOnlyDictionary<string, char> key2Val;   ...
http://rosettacode.org/wiki/Stirling_numbers_of_the_first_kind
Stirling numbers of the first kind
Stirling numbers of the first kind, or Stirling cycle numbers, count permutations according to their number of cycles (counting fixed points as cycles of length one). They may be defined directly to be the number of permutations of n elements with k disjoint cycles. Stirling numbers of the first kind express coeffici...
#ALGOL_W
ALGOL W
begin % show some (unsigned) Stirling numbers of the first kind  % integer MAX_STIRLING; MAX_STIRLING := 12; begin  % construct a matrix of Stirling numbers up to max n, max n  % integer array s1 ( 0 :: MAX_STIRLING, 0 :: MAX_STIRLING ); for n := 0 until MAX_STIRL...
http://rosettacode.org/wiki/Stirling_numbers_of_the_first_kind
Stirling numbers of the first kind
Stirling numbers of the first kind, or Stirling cycle numbers, count permutations according to their number of cycles (counting fixed points as cycles of length one). They may be defined directly to be the number of permutations of n elements with k disjoint cycles. Stirling numbers of the first kind express coeffici...
#C
C
#include <stdbool.h> #include <stdio.h> #include <stdlib.h>   typedef struct stirling_cache_tag { int max; int* values; } stirling_cache;   int stirling_number1(stirling_cache* sc, int n, int k) { if (k == 0) return n == 0 ? 1 : 0; if (n > sc->max || k > n) return 0; return sc->value...
http://rosettacode.org/wiki/String_append
String append
Basic Data Operation This is a basic data operation. It represents a fundamental action on a basic data type. You may see other such operations in the Basic Data Operations category, or: Integer Operations Arithmetic | Comparison Boolean Operations Bitwise | Logical String Operations Concatenation | Interpolation |...
#Clojure
Clojure
user=> (def s "app") #'user/s user=> s "app" user=> (def s (str s "end")) #'user/s user=> s "append"
http://rosettacode.org/wiki/String_append
String append
Basic Data Operation This is a basic data operation. It represents a fundamental action on a basic data type. You may see other such operations in the Basic Data Operations category, or: Integer Operations Arithmetic | Comparison Boolean Operations Bitwise | Logical String Operations Concatenation | Interpolation |...
#COBOL
COBOL
identification division. program-id. string-append.   data division. working-storage section. 01 some-string. 05 elements pic x occurs 0 to 80 times depending on limiter. 01 limiter usa...
http://rosettacode.org/wiki/Stream_merge
Stream merge
2-stream merge Read two sorted streams of items from external source (e.g. disk, or network), and write one stream of sorted items to external sink. Common algorithm: keep 1 buffered item from each source, select minimal of them, write it, fetch another item from that stream from which the written item was. N-strea...
#Ada
Ada
with Ada.Text_Io; with Ada.Command_Line; with Ada.Containers.Indefinite_Holders;   procedure Stream_Merge is   package String_Holders is new Ada.Containers.Indefinite_Holders (String);   use Ada.Text_Io, String_Holders;   type Stream_Type is record File  : File_Type; Value : Holder; ...
http://rosettacode.org/wiki/Stirling_numbers_of_the_second_kind
Stirling numbers of the second kind
Stirling numbers of the second kind, or Stirling partition numbers, are the number of ways to partition a set of n objects into k non-empty subsets. They are closely related to Bell numbers, and may be derived from them. Stirling numbers of the second kind obey the recurrence relation: S2(n, 0) and S2(0, k) = 0 ...
#Tcl
Tcl
proc S2 {n k} { set nk [list $n $k] if {[info exists ::S2cache($nk)]} { return $::S2cache($nk) } if {($n > 0 && $k == 0) || ($n == 0 && $k > 0)} { return 0 } if {$n == $k} { return 1 } if {$n < $k} { return 0 } set n1 [expr {$n - 1}] set k...
http://rosettacode.org/wiki/Straddling_checkerboard
Straddling checkerboard
Task Implement functions to encrypt and decrypt a message using the straddling checkerboard method. The checkerboard should take a 28 character alphabet (A-Z plus a full stop and an escape character) and two different numbers representing the blanks in the first row. The output will be a series of decimal digits. Num...
#C.2B.2B
C++
#include <iostream> #include <string> #include <map> #include <algorithm> // for min, max using namespace std;   class StraddlingCheckerboard { map<char, string> table; char first[10], second[10], third[10]; int rowU, rowV;   public: StraddlingCheckerboard(const string &alphabet, int u, int v) { rowU = mi...
http://rosettacode.org/wiki/Stirling_numbers_of_the_first_kind
Stirling numbers of the first kind
Stirling numbers of the first kind, or Stirling cycle numbers, count permutations according to their number of cycles (counting fixed points as cycles of length one). They may be defined directly to be the number of permutations of n elements with k disjoint cycles. Stirling numbers of the first kind express coeffici...
#C.2B.2B
C++
#include <algorithm> #include <iomanip> #include <iostream> #include <map> #include <gmpxx.h>   using integer = mpz_class;   class unsigned_stirling1 { public: integer get(int n, int k); private: std::map<std::pair<int, int>, integer> cache_; };   integer unsigned_stirling1::get(int n, int k) { if (k == 0) ...
http://rosettacode.org/wiki/String_append
String append
Basic Data Operation This is a basic data operation. It represents a fundamental action on a basic data type. You may see other such operations in the Basic Data Operations category, or: Integer Operations Arithmetic | Comparison Boolean Operations Bitwise | Logical String Operations Concatenation | Interpolation |...
#CoffeeScript
CoffeeScript
a = "Hello, " b = "World!" c = a + b   console.log c
http://rosettacode.org/wiki/String_append
String append
Basic Data Operation This is a basic data operation. It represents a fundamental action on a basic data type. You may see other such operations in the Basic Data Operations category, or: Integer Operations Arithmetic | Comparison Boolean Operations Bitwise | Logical String Operations Concatenation | Interpolation |...
#Common_Lisp
Common Lisp
(defmacro concatenatef (s &rest strs) "Append additional strings to the first string in-place." `(setf ,s (concatenate 'string ,s ,@strs))) (defvar *str* "foo") (concatenatef *str* "bar") (format T "~a~%" *str*) (concatenatef *str* "baz" "abc" "def") (format T "~a~%" *str*)
http://rosettacode.org/wiki/Stream_merge
Stream merge
2-stream merge Read two sorted streams of items from external source (e.g. disk, or network), and write one stream of sorted items to external sink. Common algorithm: keep 1 buffered item from each source, select minimal of them, write it, fetch another item from that stream from which the written item was. N-strea...
#ALGOL_68
ALGOL 68
# merge a number of input files to an output file # PROC mergenf = ( []REF FILE inf, REF FILE out )VOID: BEGIN INT eof count := 0; BOOL at eof := FALSE; []REF FILE inputs = inf[ AT 1 ]; INT number of files = UPB inputs; [ num...
http://rosettacode.org/wiki/Stirling_numbers_of_the_second_kind
Stirling numbers of the second kind
Stirling numbers of the second kind, or Stirling partition numbers, are the number of ways to partition a set of n objects into k non-empty subsets. They are closely related to Bell numbers, and may be derived from them. Stirling numbers of the second kind obey the recurrence relation: S2(n, 0) and S2(0, k) = 0 ...
#Visual_Basic_.NET
Visual Basic .NET
Imports System.Numerics   Module Module1   Class Sterling Private Shared ReadOnly COMPUTED As New Dictionary(Of String, BigInteger)   Private Shared Function CacheKey(n As Integer, k As Integer) As String Return String.Format("{0}:{1}", n, k) End Function   Private Shared...
http://rosettacode.org/wiki/Straddling_checkerboard
Straddling checkerboard
Task Implement functions to encrypt and decrypt a message using the straddling checkerboard method. The checkerboard should take a 28 character alphabet (A-Z plus a full stop and an escape character) and two different numbers representing the blanks in the first row. The output will be a series of decimal digits. Num...
#D
D
import std.stdio, std.algorithm, std.string, std.array;   immutable T = ["79|0|1|2|3|4|5|6|7|8|9", "|H|O|L||M|E|S||R|T", "3|A|B|C|D|F|G|I|J|K|N", "7|P|Q|U|V|W|X|Y|Z|.|/"] .map!(r => r.split("|")).array;   enum straddle = (in string s) pure /*nothrow @safe*/ => toUpper(s) .split("") ...
http://rosettacode.org/wiki/Stirling_numbers_of_the_first_kind
Stirling numbers of the first kind
Stirling numbers of the first kind, or Stirling cycle numbers, count permutations according to their number of cycles (counting fixed points as cycles of length one). They may be defined directly to be the number of permutations of n elements with k disjoint cycles. Stirling numbers of the first kind express coeffici...
#D
D
import std.bigint; import std.functional; import std.stdio;   alias sterling1 = memoize!sterling1Impl; BigInt sterling1Impl(int n, int k) { if (n == 0 && k == 0) { return BigInt(1); } if (n > 0 && k == 0) { return BigInt(0); } if (k > n) { return BigInt(0); } return s...
http://rosettacode.org/wiki/String_append
String append
Basic Data Operation This is a basic data operation. It represents a fundamental action on a basic data type. You may see other such operations in the Basic Data Operations category, or: Integer Operations Arithmetic | Comparison Boolean Operations Bitwise | Logical String Operations Concatenation | Interpolation |...
#D
D
import std.stdio;   void main() { string s = "Hello"; s ~= " world!"; writeln(s); }
http://rosettacode.org/wiki/String_append
String append
Basic Data Operation This is a basic data operation. It represents a fundamental action on a basic data type. You may see other such operations in the Basic Data Operations category, or: Integer Operations Arithmetic | Comparison Boolean Operations Bitwise | Logical String Operations Concatenation | Interpolation |...
#DBL
DBL
;Concatenate "Hello world!" STR='Hello' STR(%TRIM(STR)+2:5)='world' STR(%TRIM(STR)+1:1)='!'
http://rosettacode.org/wiki/Stream_merge
Stream merge
2-stream merge Read two sorted streams of items from external source (e.g. disk, or network), and write one stream of sorted items to external sink. Common algorithm: keep 1 buffered item from each source, select minimal of them, write it, fetch another item from that stream from which the written item was. N-strea...
#ATS
ATS
  (* ****** ****** *) // // This is a memory-clean implementation: // Every byte of allocated memory is freed // before the program exits. // (* ****** ****** *) // #include "share/atspre_define.hats" #include "share/atspre_staload.hats" // (* #include "share/HATS/atspre_staload_libats_ML.hats" *) // (* ****** ****** *...
http://rosettacode.org/wiki/Stream_merge
Stream merge
2-stream merge Read two sorted streams of items from external source (e.g. disk, or network), and write one stream of sorted items to external sink. Common algorithm: keep 1 buffered item from each source, select minimal of them, write it, fetch another item from that stream from which the written item was. N-strea...
#AWK
AWK
  # syntax: GAWK -f STREAM_MERGE.AWK filename(s) >output # handles 1 .. N files # # variable purpose # ---------- ------- # data_arr holds last record read # fn_arr filenames on command line # fnr_arr record counts for each file # status_arr file status: 1=more data, 0=EOF, -1=error # BEGIN { files = ARG...
http://rosettacode.org/wiki/Stirling_numbers_of_the_second_kind
Stirling numbers of the second kind
Stirling numbers of the second kind, or Stirling partition numbers, are the number of ways to partition a set of n objects into k non-empty subsets. They are closely related to Bell numbers, and may be derived from them. Stirling numbers of the second kind obey the recurrence relation: S2(n, 0) and S2(0, k) = 0 ...
#Wren
Wren
import "/big" for BigInt import "/fmt" for Fmt   var computed = {}   var stirling2 // recursive stirling2 = Fn.new { |n, k| var key = "%(n),%(k)" if (computed.containsKey(key)) return computed[key] if (n == 0 && k == 0) return BigInt.one if ((n > 0 && k == 0) || (n == 0 && k > 0)) return BigInt.zero ...
http://rosettacode.org/wiki/Straddling_checkerboard
Straddling checkerboard
Task Implement functions to encrypt and decrypt a message using the straddling checkerboard method. The checkerboard should take a 28 character alphabet (A-Z plus a full stop and an escape character) and two different numbers representing the blanks in the first row. The output will be a series of decimal digits. Num...
#F.23
F#
  (* Encode and Decode using StraddlingCheckerboard Nigel Galloway May 15th., 2017 *) type G={n:char;i:char;g:System.Collections.Generic.Dictionary<(char*char),string>;e:System.Collections.Generic.Dictionary<char,string>} member G.encode n=n|>Seq.map(fun n->if (n='/') then G.e.['/']+string n else match (G.e.TryG...
http://rosettacode.org/wiki/Stirling_numbers_of_the_first_kind
Stirling numbers of the first kind
Stirling numbers of the first kind, or Stirling cycle numbers, count permutations according to their number of cycles (counting fixed points as cycles of length one). They may be defined directly to be the number of permutations of n elements with k disjoint cycles. Stirling numbers of the first kind express coeffici...
#Factor
Factor
USING: arrays assocs formatting io kernel math math.polynomials math.ranges prettyprint sequences ; IN: rosetta-code.stirling-first   : stirling-row ( n -- seq ) [ { 1 } ] [ [ -1 ] dip neg [a,b) dup length 1 <array> zip { 0 1 } [ p* ] reduce [ abs ] map ] if-zero ;   "Unsigned Stirling numbers o...
http://rosettacode.org/wiki/Stirling_numbers_of_the_first_kind
Stirling numbers of the first kind
Stirling numbers of the first kind, or Stirling cycle numbers, count permutations according to their number of cycles (counting fixed points as cycles of length one). They may be defined directly to be the number of permutations of n elements with k disjoint cycles. Stirling numbers of the first kind express coeffici...
#FreeBASIC
FreeBASIC
dim as integer S1(0 to 12, 0 to 12) 'initially set with zeroes dim as ubyte n, k dim as string outstr   function padto( i as ubyte, j as integer ) as string return wspace(i-len(str(j)))+str(j) end function   S1(0, 0) = 1   for n = 0 to 12 'calculate table for k = 1 to n S1(n, k) = S1(n-1, k-1) - (n-...
http://rosettacode.org/wiki/String_append
String append
Basic Data Operation This is a basic data operation. It represents a fundamental action on a basic data type. You may see other such operations in the Basic Data Operations category, or: Integer Operations Arithmetic | Comparison Boolean Operations Bitwise | Logical String Operations Concatenation | Interpolation |...
#Delphi
Delphi
  program String_append;   {$APPTYPE CONSOLE}   uses System.SysUtils;   type TStringHelper = record helper for string procedure Append(str: string); end;   { TStringHelper }   procedure TStringHelper.Append(str: string); begin Self := self + str; end;   begin var h: string;   // with + operator h := '...
http://rosettacode.org/wiki/Stream_merge
Stream merge
2-stream merge Read two sorted streams of items from external source (e.g. disk, or network), and write one stream of sorted items to external sink. Common algorithm: keep 1 buffered item from each source, select minimal of them, write it, fetch another item from that stream from which the written item was. N-strea...
#C
C
/* * Rosetta Code - stream merge in C. * * Two streams (text files) with integer numbers, C89, Visual Studio 2010. * */   #define _CRT_SECURE_NO_WARNINGS #include <stdio.h> #include <stdlib.h>   #define GET(N) { if(fscanf(f##N,"%d",&b##N ) != 1) f##N = NULL; } #define PUT(N) { printf("%d\n", b##N); GET(N) }   voi...