WeixiangYan/CodeTransOcean huggingface dataset:
Task: Parameterized SQL statement




Go: package main

import (
    "database/sql"
    "fmt"

    _ "github.com/mattn/go-sqlite3"
)

func main() {
    db, _ := sql.Open("sqlite3", "rc.db")
    defer db.Close()
    db.Exec(`create table players (name, score, active, jerseyNum)`)
    db.Exec(`insert into players values ("",0,0,"99")`)
    db.Exec(`insert into players values ("",0,0,"100")`)

    
    db.Exec(`update players set name=?, score=?, active=? where jerseyNum=?`,
        "Smith, Steve", 42, true, "99")

    rows, _ := db.Query("select * from players")
    var (
        name      string
        score     int
        active    bool
        jerseyNum string
    )
    for rows.Next() {
        rows.Scan(&name, &score, &active, &jerseyNum)
        fmt.Printf("%3s %12s %3d %t\n", jerseyNum, name, score, active)
    }
    rows.Close()
}



PHP: $updatePlayers = "UPDATE `players` SET `name` = ?, `score` = ?, `active` = ?\n".
		"WHERE `jerseyNum` = ?";
$dbh = new PDO( "mysql:dbname=db;host=localhost", "username", "password" );

$updateStatement = $dbh->prepare( $updatePlayers );

$updateStatement->bindValue( 1, "Smith, Steve", PDO::PARAM_STR );
$updateStatement->bindValue( 2, 42, PDO::PARAM_INT );
$updateStatement->bindValue( 3, 1, PDO::PARAM_INT );
$updateStatement->bindValue( 4, 99, PDO::PARAM_INT );

$updateStatement->execute();

$updateStatement = $dbh->prepare( $updatePlayers );
$updateStatement->execute( array( "Smith, Steve", 42, 1, 99 ) );
Task: Parameterized SQL statement





Java: import java.sql.DriverManager;
import java.sql.Connection;
import java.sql.PreparedStatement;
 
public class DBDemo{
   private String protocol; 
   private String dbName;   
   private String username;
   private String password;

   PreparedStatement query;
 
   public int setUpAndExecPS(){
      try {
         Connection conn = DriverManager.getConnection(protocol + dbName, username, password);

         query = conn.prepareStatement(
            "UPDATE players SET name = ?, score = ?, active = ? WHERE jerseyNum = ?");
 
         query.setString(1, "Smith, Steve");
         query.setInt(2, 42);
         query.setBoolean(3, true);
         query.setInt(4, 99);
         
         return query.executeUpdate();
         
         

      } catch (Exception e) {
         e.printStackTrace();
      }

      return 0;
   }
}


PHP: $updatePlayers = "UPDATE `players` SET `name` = ?, `score` = ?, `active` = ?\n".
		"WHERE `jerseyNum` = ?";
$dbh = new PDO( "mysql:dbname=db;host=localhost", "username", "password" );

$updateStatement = $dbh->prepare( $updatePlayers );

$updateStatement->bindValue( 1, "Smith, Steve", PDO::PARAM_STR );
$updateStatement->bindValue( 2, 42, PDO::PARAM_INT );
$updateStatement->bindValue( 3, 1, PDO::PARAM_INT );
$updateStatement->bindValue( 4, 99, PDO::PARAM_INT );

$updateStatement->execute();

$updateStatement = $dbh->prepare( $updatePlayers );
$updateStatement->execute( array( "Smith, Steve", 42, 1, 99 ) );
Task: Parameterized SQL statement






PHP: $updatePlayers = "UPDATE `players` SET `name` = ?, `score` = ?, `active` = ?\n".
		"WHERE `jerseyNum` = ?";
$dbh = new PDO( "mysql:dbname=db;host=localhost", "username", "password" );

$updateStatement = $dbh->prepare( $updatePlayers );

$updateStatement->bindValue( 1, "Smith, Steve", PDO::PARAM_STR );
$updateStatement->bindValue( 2, 42, PDO::PARAM_INT );
$updateStatement->bindValue( 3, 1, PDO::PARAM_INT );
$updateStatement->bindValue( 4, 99, PDO::PARAM_INT );

$updateStatement->execute();

$updateStatement = $dbh->prepare( $updatePlayers );
$updateStatement->execute( array( "Smith, Steve", 42, 1, 99 ) );


Python: import sqlite3

db = sqlite3.connect(':memory:')


db.execute('create temp table players (name, score, active, jerseyNum)')
db.execute('insert into players values ("name",0,"false",99)')
db.execute('insert into players values ("name",0,"false",100)')




db.execute('update players set name=?, score=?, active=? where jerseyNum=?', ('Smith, Steve', 42, True, 99))


db.execute('update players set name=:name, score=:score, active=:active where jerseyNum=:num',
    {'num': 100,
     'name': 'John Doe',
     'active': False,
     'score': -1}
)


for row in db.execute('select * from players'):
   print(row)
Task: Triplet of three numbers

C: #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

#define LIMIT 6000

char *primes(unsigned int limit) {
    char *p = malloc(limit + 1);
    int i, j, sqr = sqrt(limit);
    
    p[0] = p[1] = 0;
    memset(p+2, 1, limit-1);
    for (i=2; i<=sqr; i++)
        if (p[i])
            for (j=i*2; j<=limit; j+=i)
                p[j] = 0;
            
    return p;
}

int triplet(const char *p, unsigned int n) {
    return n >= 2 && p[n-1] && p[n+3] && p[n+5];
}

int main() {
    char *p = primes(LIMIT+5);
    int i;
    
    for (i=2; i<LIMIT; i++)
        if (triplet(p, i))
            printf("%4d: %4d, %4d, %4d\n", i, i-1, i+3, i+5);
    
    free(p);
    return 0;
}



C#: #include <iostream>
#include <vector>

constexpr unsigned int LIMIT = 6000;

std::vector<bool> primes(unsigned int limit) {
    std::vector<bool> p(limit + 1, true);
    unsigned int root = std::sqrt(limit);

    p[0] = false;
    p[1] = false;

    for (size_t i = 2; i <= root; i++) {
        if (p[i]) {
            for (size_t j = 2 * i; j <= limit; j += i) {
                p[j] = false;
            }
        }
    }

    return p;
}

bool triplet(const std::vector<bool> &p, unsigned int n) {
    return n >= 2 && p[n - 1] && p[n + 3] && p[n + 5];
}

int main() {
    std::vector<bool> p = primes(LIMIT);

    for (size_t i = 2; i < LIMIT; i++) {
        if (triplet(p, i)) {
            printf("%4d: %4d, %4d, %4d\n", i, i - 1, i + 3, i + 5);
        }
    }

    return 0;
}
Task: Triplet of three numbers

C: #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

#define LIMIT 6000

char *primes(unsigned int limit) {
    char *p = malloc(limit + 1);
    int i, j, sqr = sqrt(limit);
    
    p[0] = p[1] = 0;
    memset(p+2, 1, limit-1);
    for (i=2; i<=sqr; i++)
        if (p[i])
            for (j=i*2; j<=limit; j+=i)
                p[j] = 0;
            
    return p;
}

int triplet(const char *p, unsigned int n) {
    return n >= 2 && p[n-1] && p[n+3] && p[n+5];
}

int main() {
    char *p = primes(LIMIT+5);
    int i;
    
    for (i=2; i<LIMIT; i++)
        if (triplet(p, i))
            printf("%4d: %4d, %4d, %4d\n", i, i-1, i+3, i+5);
    
    free(p);
    return 0;
}



C#: using System; using System.Collections.Generic; using System.Linq;
using T3 = System.Tuple<int, int, int>; using static System.Console;
class Program { static void Main() {
   WriteLine(" \"N\":  Prime Triplet    Adjacent (to previous)\n" +
             " ---- ----------------- -----------------------");
   foreach(var lmt in new double[]{6e3, 1e5, 1e6, 1e7, 1e8}) {
    var pr = PG.Primes((int)lmt); int l = 0, c = 0; bool a;
    foreach (var t in pr) { c += (a = l == t.Item1) ? 1 : 0;
      if (lmt < 1e5) WriteLine("{0,4}: {1,-18} {2}",
        t.Item1 + 1, t, a ? " *" : ""); l = t.Item3; }
    Console.WriteLine ("Up to {0:n0} there are {1:n0} prime triples, " +
      "of which {2:n0} were found to be adjacent.", lmt, pr.Count(), c); } } }

class PG { static bool[] f; static bool isPrT(int x, int y, int z) {
  if (x < 7) return false; return !f[x] && !f[y] && !f[z]; }
  public static IEnumerable<T3> Primes(int l) { f = new bool[l += 6];
  int j, lj, llj, lllj; j = lj = llj = lllj = 3;
  for (int d = 8, s = 9; s < l; lllj = llj, llj = lj, lj = j, j += 2, s += d += 8)
    if (!f[j]) { if (isPrT(lllj, lj, j)) yield return new T3(lllj, lj, j);
      for (int k = s, i = j << 1; k < l; k += i) f[k] = true; }
  for (; j < l; lllj = llj, llj = lj, lj = j, j += 2)
   if (isPrT(lllj, lj, j)) yield return new T3(lllj, lj, j); } }
Task: Triplet of three numbers

C: #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

#define LIMIT 6000

char *primes(unsigned int limit) {
    char *p = malloc(limit + 1);
    int i, j, sqr = sqrt(limit);
    
    p[0] = p[1] = 0;
    memset(p+2, 1, limit-1);
    for (i=2; i<=sqr; i++)
        if (p[i])
            for (j=i*2; j<=limit; j+=i)
                p[j] = 0;
            
    return p;
}

int triplet(const char *p, unsigned int n) {
    return n >= 2 && p[n-1] && p[n+3] && p[n+5];
}

int main() {
    char *p = primes(LIMIT+5);
    int i;
    
    for (i=2; i<LIMIT; i++)
        if (triplet(p, i))
            printf("%4d: %4d, %4d, %4d\n", i, i-1, i+3, i+5);
    
    free(p);
    return 0;
}


C++: #include <iostream>
#include <vector>

constexpr unsigned int LIMIT = 6000;

std::vector<bool> primes(unsigned int limit) {
    std::vector<bool> p(limit + 1, true);
    unsigned int root = std::sqrt(limit);

    p[0] = false;
    p[1] = false;

    for (size_t i = 2; i <= root; i++) {
        if (p[i]) {
            for (size_t j = 2 * i; j <= limit; j += i) {
                p[j] = false;
            }
        }
    }

    return p;
}

bool triplet(const std::vector<bool> &p, unsigned int n) {
    return n >= 2 && p[n - 1] && p[n + 3] && p[n + 5];
}

int main() {
    std::vector<bool> p = primes(LIMIT);

    for (size_t i = 2; i < LIMIT; i++) {
        if (triplet(p, i)) {
            printf("%4d: %4d, %4d, %4d\n", i, i - 1, i + 3, i + 5);
        }
    }

    return 0;
}
Task: Triplet of three numbers

C: #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

#define LIMIT 6000

char *primes(unsigned int limit) {
    char *p = malloc(limit + 1);
    int i, j, sqr = sqrt(limit);
    
    p[0] = p[1] = 0;
    memset(p+2, 1, limit-1);
    for (i=2; i<=sqr; i++)
        if (p[i])
            for (j=i*2; j<=limit; j+=i)
                p[j] = 0;
            
    return p;
}

int triplet(const char *p, unsigned int n) {
    return n >= 2 && p[n-1] && p[n+3] && p[n+5];
}

int main() {
    char *p = primes(LIMIT+5);
    int i;
    
    for (i=2; i<LIMIT; i++)
        if (triplet(p, i))
            printf("%4d: %4d, %4d, %4d\n", i, i-1, i+3, i+5);
    
    free(p);
    return 0;
}







Python: 

N = 6000
p = [None] * 6000  

for i in range(2, round(pow(N,0.5))):
    if not p[i]:
        for j in range(i*2, N, i):
            p[j] = 1


for i in range(3, N):
    if (p[i-1] or p[i+3] or p[i+5]):
        continue
    else:
        print(i, ': ', i-1,  ' ', i+3,  ' ', i+5)
Task: Triplet of three numbers


C++: #include <iostream>
#include <vector>

constexpr unsigned int LIMIT = 6000;

std::vector<bool> primes(unsigned int limit) {
    std::vector<bool> p(limit + 1, true);
    unsigned int root = std::sqrt(limit);

    p[0] = false;
    p[1] = false;

    for (size_t i = 2; i <= root; i++) {
        if (p[i]) {
            for (size_t j = 2 * i; j <= limit; j += i) {
                p[j] = false;
            }
        }
    }

    return p;
}

bool triplet(const std::vector<bool> &p, unsigned int n) {
    return n >= 2 && p[n - 1] && p[n + 3] && p[n + 5];
}

int main() {
    std::vector<bool> p = primes(LIMIT);

    for (size_t i = 2; i < LIMIT; i++) {
        if (triplet(p, i)) {
            printf("%4d: %4d, %4d, %4d\n", i, i - 1, i + 3, i + 5);
        }
    }

    return 0;
}


C#: using System; using System.Collections.Generic; using System.Linq;
using T3 = System.Tuple<int, int, int>; using static System.Console;
class Program { static void Main() {
   WriteLine(" \"N\":  Prime Triplet    Adjacent (to previous)\n" +
             " ---- ----------------- -----------------------");
   foreach(var lmt in new double[]{6e3, 1e5, 1e6, 1e7, 1e8}) {
    var pr = PG.Primes((int)lmt); int l = 0, c = 0; bool a;
    foreach (var t in pr) { c += (a = l == t.Item1) ? 1 : 0;
      if (lmt < 1e5) WriteLine("{0,4}: {1,-18} {2}",
        t.Item1 + 1, t, a ? " *" : ""); l = t.Item3; }
    Console.WriteLine ("Up to {0:n0} there are {1:n0} prime triples, " +
      "of which {2:n0} were found to be adjacent.", lmt, pr.Count(), c); } } }

class PG { static bool[] f; static bool isPrT(int x, int y, int z) {
  if (x < 7) return false; return !f[x] && !f[y] && !f[z]; }
  public static IEnumerable<T3> Primes(int l) { f = new bool[l += 6];
  int j, lj, llj, lllj; j = lj = llj = lllj = 3;
  for (int d = 8, s = 9; s < l; lllj = llj, llj = lj, lj = j, j += 2, s += d += 8)
    if (!f[j]) { if (isPrT(lllj, lj, j)) yield return new T3(lllj, lj, j);
      for (int k = s, i = j << 1; k < l; k += i) f[k] = true; }
  for (; j < l; lllj = llj, llj = lj, lj = j, j += 2)
   if (isPrT(lllj, lj, j)) yield return new T3(lllj, lj, j); } }
Task: Triplet of three numbers


C++: #include <iostream>
#include <vector>

constexpr unsigned int LIMIT = 6000;

std::vector<bool> primes(unsigned int limit) {
    std::vector<bool> p(limit + 1, true);
    unsigned int root = std::sqrt(limit);

    p[0] = false;
    p[1] = false;

    for (size_t i = 2; i <= root; i++) {
        if (p[i]) {
            for (size_t j = 2 * i; j <= limit; j += i) {
                p[j] = false;
            }
        }
    }

    return p;
}

bool triplet(const std::vector<bool> &p, unsigned int n) {
    return n >= 2 && p[n - 1] && p[n + 3] && p[n + 5];
}

int main() {
    std::vector<bool> p = primes(LIMIT);

    for (size_t i = 2; i < LIMIT; i++) {
        if (triplet(p, i)) {
            printf("%4d: %4d, %4d, %4d\n", i, i - 1, i + 3, i + 5);
        }
    }

    return 0;
}



Go: package main

import (
    "fmt"
    "rcu"
)

func main() {
    c := rcu.PrimeSieve(6003, false)
    var numbers []int
    fmt.Println("Numbers n < 6000 where: n - 1, n + 3, n + 5 are all primes:")
    for n := 4; n < 6000; n += 2 {
        if !c[n-1] && !c[n+3] && !c[n+5] {
            numbers = append(numbers, n)
        }
    }
    for _, n := range numbers {
        fmt.Printf("%6s  => ", rcu.Commatize(n))
        for _, p := range []int{n - 1, n + 3, n + 5} {
            fmt.Printf("%6s ", rcu.Commatize(p))
        }
        fmt.Println()
    }
    fmt.Printf("\n%d such numbers found.\n", len(numbers))
}
Task: Triplet of three numbers


C++: #include <iostream>
#include <vector>

constexpr unsigned int LIMIT = 6000;

std::vector<bool> primes(unsigned int limit) {
    std::vector<bool> p(limit + 1, true);
    unsigned int root = std::sqrt(limit);

    p[0] = false;
    p[1] = false;

    for (size_t i = 2; i <= root; i++) {
        if (p[i]) {
            for (size_t j = 2 * i; j <= limit; j += i) {
                p[j] = false;
            }
        }
    }

    return p;
}

bool triplet(const std::vector<bool> &p, unsigned int n) {
    return n >= 2 && p[n - 1] && p[n + 3] && p[n + 5];
}

int main() {
    std::vector<bool> p = primes(LIMIT);

    for (size_t i = 2; i < LIMIT; i++) {
        if (triplet(p, i)) {
            printf("%4d: %4d, %4d, %4d\n", i, i - 1, i + 3, i + 5);
        }
    }

    return 0;
}






Python: 

N = 6000
p = [None] * 6000  

for i in range(2, round(pow(N,0.5))):
    if not p[i]:
        for j in range(i*2, N, i):
            p[j] = 1


for i in range(3, N):
    if (p[i-1] or p[i+3] or p[i+5]):
        continue
    else:
        print(i, ': ', i-1,  ' ', i+3,  ' ', i+5)
Task: Triplet of three numbers



C#: using System; using System.Collections.Generic; using System.Linq;
using T3 = System.Tuple<int, int, int>; using static System.Console;
class Program { static void Main() {
   WriteLine(" \"N\":  Prime Triplet    Adjacent (to previous)\n" +
             " ---- ----------------- -----------------------");
   foreach(var lmt in new double[]{6e3, 1e5, 1e6, 1e7, 1e8}) {
    var pr = PG.Primes((int)lmt); int l = 0, c = 0; bool a;
    foreach (var t in pr) { c += (a = l == t.Item1) ? 1 : 0;
      if (lmt < 1e5) WriteLine("{0,4}: {1,-18} {2}",
        t.Item1 + 1, t, a ? " *" : ""); l = t.Item3; }
    Console.WriteLine ("Up to {0:n0} there are {1:n0} prime triples, " +
      "of which {2:n0} were found to be adjacent.", lmt, pr.Count(), c); } } }

class PG { static bool[] f; static bool isPrT(int x, int y, int z) {
  if (x < 7) return false; return !f[x] && !f[y] && !f[z]; }
  public static IEnumerable<T3> Primes(int l) { f = new bool[l += 6];
  int j, lj, llj, lllj; j = lj = llj = lllj = 3;
  for (int d = 8, s = 9; s < l; lllj = llj, llj = lj, lj = j, j += 2, s += d += 8)
    if (!f[j]) { if (isPrT(lllj, lj, j)) yield return new T3(lllj, lj, j);
      for (int k = s, i = j << 1; k < l; k += i) f[k] = true; }
  for (; j < l; lllj = llj, llj = lj, lj = j, j += 2)
   if (isPrT(lllj, lj, j)) yield return new T3(lllj, lj, j); } }


Go: package main

import (
    "fmt"
    "rcu"
)

func main() {
    c := rcu.PrimeSieve(6003, false)
    var numbers []int
    fmt.Println("Numbers n < 6000 where: n - 1, n + 3, n + 5 are all primes:")
    for n := 4; n < 6000; n += 2 {
        if !c[n-1] && !c[n+3] && !c[n+5] {
            numbers = append(numbers, n)
        }
    }
    for _, n := range numbers {
        fmt.Printf("%6s  => ", rcu.Commatize(n))
        for _, p := range []int{n - 1, n + 3, n + 5} {
            fmt.Printf("%6s ", rcu.Commatize(p))
        }
        fmt.Println()
    }
    fmt.Printf("\n%d such numbers found.\n", len(numbers))
}
Task: Triplet of three numbers



C#: using System; using System.Collections.Generic; using System.Linq;
using T3 = System.Tuple<int, int, int>; using static System.Console;
class Program { static void Main() {
   WriteLine(" \"N\":  Prime Triplet    Adjacent (to previous)\n" +
             " ---- ----------------- -----------------------");
   foreach(var lmt in new double[]{6e3, 1e5, 1e6, 1e7, 1e8}) {
    var pr = PG.Primes((int)lmt); int l = 0, c = 0; bool a;
    foreach (var t in pr) { c += (a = l == t.Item1) ? 1 : 0;
      if (lmt < 1e5) WriteLine("{0,4}: {1,-18} {2}",
        t.Item1 + 1, t, a ? " *" : ""); l = t.Item3; }
    Console.WriteLine ("Up to {0:n0} there are {1:n0} prime triples, " +
      "of which {2:n0} were found to be adjacent.", lmt, pr.Count(), c); } } }

class PG { static bool[] f; static bool isPrT(int x, int y, int z) {
  if (x < 7) return false; return !f[x] && !f[y] && !f[z]; }
  public static IEnumerable<T3> Primes(int l) { f = new bool[l += 6];
  int j, lj, llj, lllj; j = lj = llj = lllj = 3;
  for (int d = 8, s = 9; s < l; lllj = llj, llj = lj, lj = j, j += 2, s += d += 8)
    if (!f[j]) { if (isPrT(lllj, lj, j)) yield return new T3(lllj, lj, j);
      for (int k = s, i = j << 1; k < l; k += i) f[k] = true; }
  for (; j < l; lllj = llj, llj = lj, lj = j, j += 2)
   if (isPrT(lllj, lj, j)) yield return new T3(lllj, lj, j); } }





Python: 

N = 6000
p = [None] * 6000  

for i in range(2, round(pow(N,0.5))):
    if not p[i]:
        for j in range(i*2, N, i):
            p[j] = 1


for i in range(3, N):
    if (p[i-1] or p[i+3] or p[i+5]):
        continue
    else:
        print(i, ': ', i-1,  ' ', i+3,  ' ', i+5)
Task: Triplet of three numbers




Go: package main

import (
    "fmt"
    "rcu"
)

func main() {
    c := rcu.PrimeSieve(6003, false)
    var numbers []int
    fmt.Println("Numbers n < 6000 where: n - 1, n + 3, n + 5 are all primes:")
    for n := 4; n < 6000; n += 2 {
        if !c[n-1] && !c[n+3] && !c[n+5] {
            numbers = append(numbers, n)
        }
    }
    for _, n := range numbers {
        fmt.Printf("%6s  => ", rcu.Commatize(n))
        for _, p := range []int{n - 1, n + 3, n + 5} {
            fmt.Printf("%6s ", rcu.Commatize(p))
        }
        fmt.Println()
    }
    fmt.Printf("\n%d such numbers found.\n", len(numbers))
}




Python: 

N = 6000
p = [None] * 6000  

for i in range(2, round(pow(N,0.5))):
    if not p[i]:
        for j in range(i*2, N, i):
            p[j] = 1


for i in range(3, N):
    if (p[i-1] or p[i+3] or p[i+5]):
        continue
    else:
        print(i, ': ', i-1,  ' ', i+3,  ' ', i+5)
Task: Triplet of three numbers

C: #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

#define LIMIT 6000

char *primes(unsigned int limit) {
    char *p = malloc(limit + 1);
    int i, j, sqr = sqrt(limit);
    
    p[0] = p[1] = 0;
    memset(p+2, 1, limit-1);
    for (i=2; i<=sqr; i++)
        if (p[i])
            for (j=i*2; j<=limit; j+=i)
                p[j] = 0;
            
    return p;
}

int triplet(const char *p, unsigned int n) {
    return n >= 2 && p[n-1] && p[n+3] && p[n+5];
}

int main() {
    char *p = primes(LIMIT+5);
    int i;
    
    for (i=2; i<LIMIT; i++)
        if (triplet(p, i))
            printf("%4d: %4d, %4d, %4d\n", i, i-1, i+3, i+5);
    
    free(p);
    return 0;
}




Go: package main

import (
    "fmt"
    "rcu"
)

func main() {
    c := rcu.PrimeSieve(6003, false)
    var numbers []int
    fmt.Println("Numbers n < 6000 where: n - 1, n + 3, n + 5 are all primes:")
    for n := 4; n < 6000; n += 2 {
        if !c[n-1] && !c[n+3] && !c[n+5] {
            numbers = append(numbers, n)
        }
    }
    for _, n := range numbers {
        fmt.Printf("%6s  => ", rcu.Commatize(n))
        for _, p := range []int{n - 1, n + 3, n + 5} {
            fmt.Printf("%6s ", rcu.Commatize(p))
        }
        fmt.Println()
    }
    fmt.Printf("\n%d such numbers found.\n", len(numbers))
}
Task: Named parameters

C: #include <stdio.h>



typedef struct { int x, y, z; } FTest_args;

void FTest (FTest_args args) {
	printf("x: %d, y: %d, z: %d\n", args.x, args.y, args.z);
}

#define FT(...) FTest((FTest_args){ __VA_ARGS__ })




#define DFT(...) FTest((FTest_args){ .x = 142, .y = 143, .z = 144, __VA_ARGS__ })




void FTest2 (int x, int y, int z) {
	printf("x: %d, y: %d, z: %d\n", x, y, z);
}

static inline void FTest2_default_wrapper (FTest_args args) {
	return FTest2(args.x, args.y, args.z);
}

#define DF2(...) FTest2_default_wrapper((FTest_args){ .x = 142, .y = 143, .z = 144, __VA_ARGS__ })


int main(int argc, char **argv)
{
	
	FTest((FTest_args){ .y = 10 });
	FTest((FTest_args){ .y = 10, .z = 42 });
	FT( .z = 47, .y = 10, .x = 42 );

	
	DFT();
	DFT( .z = 99 );

	
	DF2();
	DF2( .z = 99 );

	return 0;
}


C++: class foo_params{
	friend void foo(foo_params p);
public:
    foo_params(int r):
        required_param_(r),
	optional_x_(0),
	optional_y_(1),
	optional_z_(3.1415)
	{}
     foo_params& x(int i){
	optional_x_=i;
	return *this;
     }
     foo_params& y(int i){
	optional_y_=i;
	return *this;
     }
     foo_params& z(float f){
	optional_z_=f;
	return *this;
     }
private:
        int 	required_param_;
	int 	optional_x_;
	int 	optional_y_;
	float 	optional_z_;
};
Task: Named parameters

C: #include <stdio.h>



typedef struct { int x, y, z; } FTest_args;

void FTest (FTest_args args) {
	printf("x: %d, y: %d, z: %d\n", args.x, args.y, args.z);
}

#define FT(...) FTest((FTest_args){ __VA_ARGS__ })




#define DFT(...) FTest((FTest_args){ .x = 142, .y = 143, .z = 144, __VA_ARGS__ })




void FTest2 (int x, int y, int z) {
	printf("x: %d, y: %d, z: %d\n", x, y, z);
}

static inline void FTest2_default_wrapper (FTest_args args) {
	return FTest2(args.x, args.y, args.z);
}

#define DF2(...) FTest2_default_wrapper((FTest_args){ .x = 142, .y = 143, .z = 144, __VA_ARGS__ })


int main(int argc, char **argv)
{
	
	FTest((FTest_args){ .y = 10 });
	FTest((FTest_args){ .y = 10, .z = 42 });
	FT( .z = 47, .y = 10, .x = 42 );

	
	DFT();
	DFT( .z = 99 );

	
	DF2();
	DF2( .z = 99 );

	return 0;
}





Java: module NamedParams
    {
    const Point(Int x, Int y)
        {
        Point with(Int? x=Null, Int? y=Null)
            {
            return new Point(x ?: this.x, y ?: this.y);
            }
        }

    @Inject Console console;

    void run()
        {
        Point origin = new Point(0, 0);
        console.print($"origin={origin}");
        Point moveRight = origin.with(x=5);
        console.print($"moveRight(x=5)={moveRight}");
        Point moveUp    = moveRight.with(y=3);
        console.print($"moveUp(y=3)={moveUp}");
        }
    }