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/Function_definition
Function definition
A function is a body of code that returns a value. The value returned may depend on arguments provided to the function. Task Write a definition of a function called "multiply" that takes two arguments and returns their product. (Argument types should be chosen so as not to distract from showing how functions are ...
#Klingphix
Klingphix
:multiply * ;   2 3 multiply print { 6 }
http://rosettacode.org/wiki/Function_definition
Function definition
A function is a body of code that returns a value. The value returned may depend on arguments provided to the function. Task Write a definition of a function called "multiply" that takes two arguments and returns their product. (Argument types should be chosen so as not to distract from showing how functions are ...
#Kotlin
Kotlin
// One-liner fun multiply(a: Int, b: Int) = a * b   // Proper function definition fun multiplyProper(a: Int, b: Int): Int { return a * b }
http://rosettacode.org/wiki/Hello_world/Text
Hello world/Text
Hello world/Text is part of Short Circuit's Console Program Basics selection. Task Display the string Hello world! on a text console. Related tasks   Hello world/Graphical   Hello world/Line Printer   Hello world/Newbie   Hello world/Newline omission   Hello world/Standard error   Hello world/Web server
#Teco
Teco
^AHello world!^A$$
http://rosettacode.org/wiki/Fork
Fork
Task Spawn a new process which can run simultaneously with, and independently of, the original parent process.
#Erlang
Erlang
-module(fork). -export([start/0]).   start() -> erlang:spawn( fun() -> child() end ), io:format("This is the original process~n").   child() -> io:format("This is the new process~n").
http://rosettacode.org/wiki/Fork
Fork
Task Spawn a new process which can run simultaneously with, and independently of, the original parent process.
#Factor
Factor
USING: unix unix.process ;   [ "Hello form child" print flush 0 _exit ] [ drop "Hi from parent" print flush ] with-fork
http://rosettacode.org/wiki/Function_definition
Function definition
A function is a body of code that returns a value. The value returned may depend on arguments provided to the function. Task Write a definition of a function called "multiply" that takes two arguments and returns their product. (Argument types should be chosen so as not to distract from showing how functions are ...
#Lambdatalk
Lambdatalk
  {def multiply {lambda {:a :b} {* :a :b}}}   {multiply 3 4} -> 12   could be written as a variadic function:   {def any_multiply {lambda {:n} // thanks to variadicity of * {* :n}}}   {any_multiply 1 2 3 4 5 6} -> 720    
http://rosettacode.org/wiki/Hello_world/Text
Hello world/Text
Hello world/Text is part of Short Circuit's Console Program Basics selection. Task Display the string Hello world! on a text console. Related tasks   Hello world/Graphical   Hello world/Line Printer   Hello world/Newbie   Hello world/Newline omission   Hello world/Standard error   Hello world/Web server
#Tern
Tern
println("Hello world!");
http://rosettacode.org/wiki/Fork
Fork
Task Spawn a new process which can run simultaneously with, and independently of, the original parent process.
#Fexl
Fexl
fork \pid print "pid = ";print pid;nl;  
http://rosettacode.org/wiki/Fork
Fork
Task Spawn a new process which can run simultaneously with, and independently of, the original parent process.
#Furor
Furor
  #g ."Kezd!\n" §child fork sto childpid @childpid wait @childpid ."child pid ez volt: " printnl end child: ."Én a child vagyok!\n" #d 3.14 printnl 2 sleep end { „childpid” }  
http://rosettacode.org/wiki/Function_definition
Function definition
A function is a body of code that returns a value. The value returned may depend on arguments provided to the function. Task Write a definition of a function called "multiply" that takes two arguments and returns their product. (Argument types should be chosen so as not to distract from showing how functions are ...
#langur
langur
val .multiply = f(.x, .y) .x x .y .multiply(3, 4)
http://rosettacode.org/wiki/Function_definition
Function definition
A function is a body of code that returns a value. The value returned may depend on arguments provided to the function. Task Write a definition of a function called "multiply" that takes two arguments and returns their product. (Argument types should be chosen so as not to distract from showing how functions are ...
#Lasso
Lasso
define multiply(a,b) => { return #a * #b }
http://rosettacode.org/wiki/Hello_world/Text
Hello world/Text
Hello world/Text is part of Short Circuit's Console Program Basics selection. Task Display the string Hello world! on a text console. Related tasks   Hello world/Graphical   Hello world/Line Printer   Hello world/Newbie   Hello world/Newline omission   Hello world/Standard error   Hello world/Web server
#Terra
Terra
C = terralib.includec("stdio.h")   terra hello(argc : int, argv : &rawstring) C.printf("Hello world!\n") return 0 end
http://rosettacode.org/wiki/Fork
Fork
Task Spawn a new process which can run simultaneously with, and independently of, the original parent process.
#FreeBASIC
FreeBASIC
  Function script(s As String) As String Dim As String g = _ "Set WshShell = WScript.CreateObject(""WScript.Shell"")" + _ Chr(13,10) + "Return = WshShell.Run("""+s+" "",1,0)" Return g End Function     Function guardaArchivo(nombreArchivo As String, p As String) As String Dim As Long n = Freefile ...
http://rosettacode.org/wiki/Fork
Fork
Task Spawn a new process which can run simultaneously with, and independently of, the original parent process.
#Go
Go
package main   import ( "fmt" "os" )   func main() { fmt.Printf("PID: %v\n", os.Getpid()) if len(os.Args) < 2 { fmt.Println("Done.") return } cp, err := os.StartProcess(os.Args[0], nil, &os.ProcAttr{Files: []*os.File{nil, os.Stdout}}, ) if err != nil { fmt...
http://rosettacode.org/wiki/Function_definition
Function definition
A function is a body of code that returns a value. The value returned may depend on arguments provided to the function. Task Write a definition of a function called "multiply" that takes two arguments and returns their product. (Argument types should be chosen so as not to distract from showing how functions are ...
#Latitude
Latitude
multiply := { $1 * $2. }.
http://rosettacode.org/wiki/Hello_world/Text
Hello world/Text
Hello world/Text is part of Short Circuit's Console Program Basics selection. Task Display the string Hello world! on a text console. Related tasks   Hello world/Graphical   Hello world/Line Printer   Hello world/Newbie   Hello world/Newline omission   Hello world/Standard error   Hello world/Web server
#Terraform
Terraform
output "result" { value = "Hello world!" }
http://rosettacode.org/wiki/Fork
Fork
Task Spawn a new process which can run simultaneously with, and independently of, the original parent process.
#Groovy
Groovy
println "BEFORE PROCESS" Process p = Runtime.runtime.exec(''' C:/cygwin/bin/sh -c " /usr/bin/date +'BEFORE LOOP: %T'; for i in 1 2 3 4 ; do /usr/bin/sleep 1; /usr/bin/echo \$i; done; /usr/bin/date +'AFTER LOOP: %T'" ''') p.consumeProcessOutput(System.out, System.err) (0..<8).each { Thread.sleep(500) pri...
http://rosettacode.org/wiki/Function_definition
Function definition
A function is a body of code that returns a value. The value returned may depend on arguments provided to the function. Task Write a definition of a function called "multiply" that takes two arguments and returns their product. (Argument types should be chosen so as not to distract from showing how functions are ...
#LFE
LFE
  (defun mutiply (a b) (* a b))  
http://rosettacode.org/wiki/Hello_world/Text
Hello world/Text
Hello world/Text is part of Short Circuit's Console Program Basics selection. Task Display the string Hello world! on a text console. Related tasks   Hello world/Graphical   Hello world/Line Printer   Hello world/Newbie   Hello world/Newline omission   Hello world/Standard error   Hello world/Web server
#TestML
TestML
%TestML 0.1.0 Print("Hello world!")
http://rosettacode.org/wiki/Fork
Fork
Task Spawn a new process which can run simultaneously with, and independently of, the original parent process.
#Haskell
Haskell
import System.Posix.Process   main = do forkProcess (putStrLn "This is the new process") putStrLn "This is the original process"
http://rosettacode.org/wiki/Fork
Fork
Task Spawn a new process which can run simultaneously with, and independently of, the original parent process.
#HicEst
HicEst
SYSTEM( RUN )   WRITE(Messagebox='?Y', IOStat=ios) "Another Fork?" IF(ios == 2) ALARM(999) ! quit immediately   ! assume this script is stored as 'Fork.hic' SYSTEM(SHell='Fork.hic')   BEEP("c e g 'c") WRITE(Messagebox="!") "Waiting ..." ALARM(999) ! quit immediately
http://rosettacode.org/wiki/Function_definition
Function definition
A function is a body of code that returns a value. The value returned may depend on arguments provided to the function. Task Write a definition of a function called "multiply" that takes two arguments and returns their product. (Argument types should be chosen so as not to distract from showing how functions are ...
#Liberty_BASIC
Liberty BASIC
' define & call a function   print multiply( 3, 1.23456)   wait   function multiply( m1, m2) multiply =m1 *m2 end function   end
http://rosettacode.org/wiki/Hello_world/Text
Hello world/Text
Hello world/Text is part of Short Circuit's Console Program Basics selection. Task Display the string Hello world! on a text console. Related tasks   Hello world/Graphical   Hello world/Line Printer   Hello world/Newbie   Hello world/Newline omission   Hello world/Standard error   Hello world/Web server
#TI-83_BASIC
TI-83 BASIC
Disp "Hello world!
http://rosettacode.org/wiki/Four_is_the_number_of_letters_in_the_...
Four is the number of letters in the ...
The     Four is ...     sequence is based on the counting of the number of letters in the words of the (never─ending) sentence: Four is the number of letters in the first word of this sentence, two in the second, three in the third, six in the fourth, two in the fifth, seven in the sixth, ··· Definitions and...
#C
C
#include <ctype.h> #include <locale.h> #include <stdbool.h> #include <stdio.h> #include <stdint.h> #include <glib.h>   typedef uint64_t integer;   typedef struct number_names_tag { const char* cardinal; const char* ordinal; } number_names;   const number_names small[] = { { "zero", "zeroth" }, { "one", "fir...
http://rosettacode.org/wiki/Fork
Fork
Task Spawn a new process which can run simultaneously with, and independently of, the original parent process.
#Icon_and_Unicon
Icon and Unicon
procedure main() if (fork()|runerr(500)) = 0 then write("child") else { delay(1000) write("parent") } end
http://rosettacode.org/wiki/Fork
Fork
Task Spawn a new process which can run simultaneously with, and independently of, the original parent process.
#J
J
  load'dll' Fork =: (('Error'"_)`('Parent'"_)`)(@.([: >: [: * '/lib/x86_64-linux-gnu/libc-2.19.so __fork > x' cd [: i. 0&[))
http://rosettacode.org/wiki/Function_definition
Function definition
A function is a body of code that returns a value. The value returned may depend on arguments provided to the function. Task Write a definition of a function called "multiply" that takes two arguments and returns their product. (Argument types should be chosen so as not to distract from showing how functions are ...
#Lily
Lily
define multiply(a: Integer, b: Integer): Integer { return a * b }
http://rosettacode.org/wiki/Function_definition
Function definition
A function is a body of code that returns a value. The value returned may depend on arguments provided to the function. Task Write a definition of a function called "multiply" that takes two arguments and returns their product. (Argument types should be chosen so as not to distract from showing how functions are ...
#Lingo
Lingo
on multiply (a, b) return a * b end
http://rosettacode.org/wiki/Hello_world/Text
Hello world/Text
Hello world/Text is part of Short Circuit's Console Program Basics selection. Task Display the string Hello world! on a text console. Related tasks   Hello world/Graphical   Hello world/Line Printer   Hello world/Newbie   Hello world/Newline omission   Hello world/Standard error   Hello world/Web server
#TI-89_BASIC
TI-89 BASIC
Disp "Hello world!"
http://rosettacode.org/wiki/Four_is_the_number_of_letters_in_the_...
Four is the number of letters in the ...
The     Four is ...     sequence is based on the counting of the number of letters in the words of the (never─ending) sentence: Four is the number of letters in the first word of this sentence, two in the second, three in the third, six in the fourth, two in the fifth, seven in the sixth, ··· Definitions and...
#C.2B.2B
C++
#include <cctype> #include <cstdint> #include <iomanip> #include <iostream> #include <string> #include <vector>   struct number_names { const char* cardinal; const char* ordinal; };   const number_names small[] = { { "zero", "zeroth" }, { "one", "first" }, { "two", "second" }, { "three", "third" }, { "f...
http://rosettacode.org/wiki/Fork
Fork
Task Spawn a new process which can run simultaneously with, and independently of, the original parent process.
#Java
Java
  import java.io.IOException; import java.io.InputStreamReader; import java.io.BufferedReader; import java.util.Arrays; import java.util.List; import java.util.Map;   public class RFork {   public static void main(String[] args) { ProcessBuilder pb; Process pp; List<String> command; Map<String, String...
http://rosettacode.org/wiki/Function_definition
Function definition
A function is a body of code that returns a value. The value returned may depend on arguments provided to the function. Task Write a definition of a function called "multiply" that takes two arguments and returns their product. (Argument types should be chosen so as not to distract from showing how functions are ...
#LiveCode
LiveCode
function multiplyy n1 n2 return n1 * n2 end multiplyy   put multiplyy(2,5) -- = 10
http://rosettacode.org/wiki/Function_definition
Function definition
A function is a body of code that returns a value. The value returned may depend on arguments provided to the function. Task Write a definition of a function called "multiply" that takes two arguments and returns their product. (Argument types should be chosen so as not to distract from showing how functions are ...
#Locomotive_Basic
Locomotive Basic
10 DEF FNmultiply(x,y)=x*y 20 PRINT FNmultiply(2,PI)
http://rosettacode.org/wiki/Hello_world/Text
Hello world/Text
Hello world/Text is part of Short Circuit's Console Program Basics selection. Task Display the string Hello world! on a text console. Related tasks   Hello world/Graphical   Hello world/Line Printer   Hello world/Newbie   Hello world/Newline omission   Hello world/Standard error   Hello world/Web server
#Tiny_BASIC
Tiny BASIC
  10 PRINT "Hello, World!"  
http://rosettacode.org/wiki/Four_is_the_number_of_letters_in_the_...
Four is the number of letters in the ...
The     Four is ...     sequence is based on the counting of the number of letters in the words of the (never─ending) sentence: Four is the number of letters in the first word of this sentence, two in the second, three in the third, six in the fourth, two in the fifth, seven in the sixth, ··· Definitions and...
#Go
Go
package main   import ( "fmt" "strings" "unicode" )   func main() { f := NewFourIsSeq() fmt.Print("The lengths of the first 201 words are:") for i := 1; i <= 201; i++ { if i%25 == 1 { fmt.Printf("\n%3d: ", i) } _, n := f.WordLen(i) fmt.Printf(" %2d", n) } fmt.Println() fmt.Println("Length of sentenc...
http://rosettacode.org/wiki/Fork
Fork
Task Spawn a new process which can run simultaneously with, and independently of, the original parent process.
#Julia
Julia
println("Parent running.") @async(begin sleep(1); println("This is the child process."); sleep(2); println("Child again.") end) sleep(2) println("This is the parent process again.") sleep(2) println("Parent again.")  
http://rosettacode.org/wiki/Fork
Fork
Task Spawn a new process which can run simultaneously with, and independently of, the original parent process.
#Kotlin
Kotlin
// version 1.1.51   import java.io.InputStreamReader import java.io.BufferedReader import java.io.IOException   fun main(args: Array<String>) { try { val pb = ProcessBuilder() val currentUser = pb.environment().get("USER") val command = listOf("ps", "-f", "U", currentUser) pb.command...
http://rosettacode.org/wiki/Function_definition
Function definition
A function is a body of code that returns a value. The value returned may depend on arguments provided to the function. Task Write a definition of a function called "multiply" that takes two arguments and returns their product. (Argument types should be chosen so as not to distract from showing how functions are ...
#Logo
Logo
to multiply :x :y output :x * :y end
http://rosettacode.org/wiki/Function_definition
Function definition
A function is a body of code that returns a value. The value returned may depend on arguments provided to the function. Task Write a definition of a function called "multiply" that takes two arguments and returns their product. (Argument types should be chosen so as not to distract from showing how functions are ...
#LSE64
LSE64
multiply  : * multiply. : *. # floating point
http://rosettacode.org/wiki/Hello_world/Text
Hello world/Text
Hello world/Text is part of Short Circuit's Console Program Basics selection. Task Display the string Hello world! on a text console. Related tasks   Hello world/Graphical   Hello world/Line Printer   Hello world/Newbie   Hello world/Newline omission   Hello world/Standard error   Hello world/Web server
#TMG
TMG
begin: parse(( = { <Hello, World!> * } ));
http://rosettacode.org/wiki/Formatted_numeric_output
Formatted numeric output
Task Express a number in decimal as a fixed-length string with leading zeros. For example, the number   7.125   could be expressed as   00007.125.
#11l
11l
print(‘#05.3’.format(7.125))
http://rosettacode.org/wiki/Four_is_the_number_of_letters_in_the_...
Four is the number of letters in the ...
The     Four is ...     sequence is based on the counting of the number of letters in the words of the (never─ending) sentence: Four is the number of letters in the first word of this sentence, two in the second, three in the third, six in the fourth, two in the fifth, seven in the sixth, ··· Definitions and...
#Haskell
Haskell
import Data.Char   sentence = start ++ foldMap add (zip [2..] $ tail $ words sentence) where start = "Four is the number of letters in the first word of this sentence, " add (i, w) = unwords [spellInteger (alphaLength w), "in the", spellOrdinal i ++ ", "]   alphaLength w = fromIntegral $ length $ filter isAlp...
http://rosettacode.org/wiki/Fork
Fork
Task Spawn a new process which can run simultaneously with, and independently of, the original parent process.
#Lasso
Lasso
local(mydata = 'I am data one')   split_thread => { loop(2) => { sleep(2000) stdoutnl(#mydata) #mydata = 'Oh, looks like I am in a new thread' } }   loop(2) => { sleep(3000) stdoutnl(#mydata) #mydata = 'Aha, I am still in the original thread' }
http://rosettacode.org/wiki/Fork
Fork
Task Spawn a new process which can run simultaneously with, and independently of, the original parent process.
#LFE
LFE
  (defun start () (spawn (lambda () (child))))   (defun child () (lfe_io:format "This is the new process~n" '()))  
http://rosettacode.org/wiki/Function_definition
Function definition
A function is a body of code that returns a value. The value returned may depend on arguments provided to the function. Task Write a definition of a function called "multiply" that takes two arguments and returns their product. (Argument types should be chosen so as not to distract from showing how functions are ...
#Lua
Lua
function multiply( a, b ) return a * b end
http://rosettacode.org/wiki/Hello_world/Text
Hello world/Text
Hello world/Text is part of Short Circuit's Console Program Basics selection. Task Display the string Hello world! on a text console. Related tasks   Hello world/Graphical   Hello world/Line Printer   Hello world/Newbie   Hello world/Newline omission   Hello world/Standard error   Hello world/Web server
#TorqueScript
TorqueScript
echo("Hello world!");
http://rosettacode.org/wiki/Formatted_numeric_output
Formatted numeric output
Task Express a number in decimal as a fixed-length string with leading zeros. For example, the number   7.125   could be expressed as   00007.125.
#8086_Assembly
8086 Assembly
.model small .stack 1024 .data ;data segment is unused in this program .code   start:   mov ax,@code mov ds,ax mov es,ax   cld ;make lodsb, etc. auto-increment   mov al, byte ptr [ds:LeadingZeroes] mov cl,al mov ch,0 mov al,'0' ;30h jcxz DonePrintingLeadingZeroes ;there are le...
http://rosettacode.org/wiki/Four_is_the_number_of_letters_in_the_...
Four is the number of letters in the ...
The     Four is ...     sequence is based on the counting of the number of letters in the words of the (never─ending) sentence: Four is the number of letters in the first word of this sentence, two in the second, three in the third, six in the fourth, two in the fifth, seven in the sixth, ··· Definitions and...
#Java
Java
  import java.util.HashMap; import java.util.Map;   public class FourIsTheNumberOfLetters {   public static void main(String[] args) { String [] words = neverEndingSentence(201); System.out.printf("Display the first 201 numbers in the sequence:%n%3d: ", 1); for ( int i = 0 ; i < words.length...
http://rosettacode.org/wiki/Fork
Fork
Task Spawn a new process which can run simultaneously with, and independently of, the original parent process.
#Lua
Lua
local posix = require 'posix'   local pid = posix.fork() if pid == 0 then print("child process") elseif pid > 0 then print("parent process") else error("unable to fork") end
http://rosettacode.org/wiki/Fork
Fork
Task Spawn a new process which can run simultaneously with, and independently of, the original parent process.
#Mathematica.2FWolfram_Language
Mathematica/Wolfram Language
commandstring = First[$CommandLine] <> " -noprompt -run \"Put[Factorial[20],ToFileName[$TemporaryDirectory,ToString[temp1]]];Quit[]\"" ->"MathKernel -noprompt -run \"Put[Factorial[20],ToFileName[$TemporaryDirectory,ToString[temp1]]];Quit[]\""   Run[commandstring] ->0
http://rosettacode.org/wiki/Function_definition
Function definition
A function is a body of code that returns a value. The value returned may depend on arguments provided to the function. Task Write a definition of a function called "multiply" that takes two arguments and returns their product. (Argument types should be chosen so as not to distract from showing how functions are ...
#Lucid
Lucid
multiply(x,y) = x * y
http://rosettacode.org/wiki/Hello_world/Text
Hello world/Text
Hello world/Text is part of Short Circuit's Console Program Basics selection. Task Display the string Hello world! on a text console. Related tasks   Hello world/Graphical   Hello world/Line Printer   Hello world/Newbie   Hello world/Newline omission   Hello world/Standard error   Hello world/Web server
#TPP
TPP
Hello world!
http://rosettacode.org/wiki/Formal_power_series
Formal power series
A power series is an infinite sum of the form a 0 + a 1 ⋅ x + a 2 ⋅ x 2 + a 3 ⋅ x 3 + ⋯ {\displaystyle a_{0}+a_{1}\cdot x+a_{2}\cdot x^{2}+a_{3}\cdot x^{3}+\cdots } The ai are called the coefficients of the series. Such sums can be added, multiplied etc., where the new coefficients of ...
#Ada
Ada
with Generic_Rational;   generic with package Rational_Numbers is new Generic_Rational (<>); package Generic_Taylor_Series is use Rational_Numbers; type Taylor_Series is array (Natural range <>) of Rational;   function "+" (A : Taylor_Series) return Taylor_Series; function "-" (A : Taylor_Series) return ...
http://rosettacode.org/wiki/Formatted_numeric_output
Formatted numeric output
Task Express a number in decimal as a fixed-length string with leading zeros. For example, the number   7.125   could be expressed as   00007.125.
#8th
8th
  7.125 "%09.3f" s:strfmt . cr  
http://rosettacode.org/wiki/Formatted_numeric_output
Formatted numeric output
Task Express a number in decimal as a fixed-length string with leading zeros. For example, the number   7.125   could be expressed as   00007.125.
#AArch64_Assembly
AArch64 Assembly
  /* ARM assembly AARCH64 Raspberry PI 3B */ /* program formatNum64.s */ /* use C library printf ha, ha, ha !!! */   /*******************************************/ /* Constantes file */ /*******************************************/ /* for this file see task include a file in language AArch64 ...
http://rosettacode.org/wiki/Four_is_the_number_of_letters_in_the_...
Four is the number of letters in the ...
The     Four is ...     sequence is based on the counting of the number of letters in the words of the (never─ending) sentence: Four is the number of letters in the first word of this sentence, two in the second, three in the third, six in the fourth, two in the fifth, seven in the sixth, ··· Definitions and...
#Julia
Julia
using DataStructures # for deque   const seed = "Four is the number of letters in the first word of this sentence, " const (word2, word3) = ("in", "the")   lettercount(w) = length(w) - length(collect(eachmatch(r"-", w))) splits(txt) = [x.match for x in eachmatch(r"[\w\-]+", txt)] todq(sentence) = (d = Deque{String}();...
http://rosettacode.org/wiki/Four_is_the_number_of_letters_in_the_...
Four is the number of letters in the ...
The     Four is ...     sequence is based on the counting of the number of letters in the words of the (never─ending) sentence: Four is the number of letters in the first word of this sentence, two in the second, three in the third, six in the fourth, two in the fifth, seven in the sixth, ··· Definitions and...
#Kotlin
Kotlin
// version 1.1.4-3   val names = mapOf( 1 to "one", 2 to "two", 3 to "three", 4 to "four", 5 to "five", 6 to "six", 7 to "seven", 8 to "eight", 9 to "nine", 10 to "ten", 11 to "eleven", 12 to "twelve", 13 to "thirteen", 14 to "fourteen", 15 to "fifteen", 1...
http://rosettacode.org/wiki/Fork
Fork
Task Spawn a new process which can run simultaneously with, and independently of, the original parent process.
#NetRexx
NetRexx
/* NetRexx */ options replace format comments java crossref symbols binary   runSample(arg) return   -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ method runSample(arg) private static   do pb = ProcessBuilder([String '']) env = pb.environment() currentuser = String env.g...
http://rosettacode.org/wiki/Fork
Fork
Task Spawn a new process which can run simultaneously with, and independently of, the original parent process.
#NewLISP
NewLISP
(let (pid (fork (println "Hello from child"))) (cond ((nil? pid) (throw-error "Unable to fork")) ('t (wait-pid pid))))
http://rosettacode.org/wiki/Function_definition
Function definition
A function is a body of code that returns a value. The value returned may depend on arguments provided to the function. Task Write a definition of a function called "multiply" that takes two arguments and returns their product. (Argument types should be chosen so as not to distract from showing how functions are ...
#M2000_Interpreter
M2000 Interpreter
  Module Checkit { Module Multiply (a, b) { Push a*b } Multiply 10, 5 Print Number=50   Module Multiply { Push Number*Number }   Multiply 10, 5 Print Number=50 \\ push before call Push 10, 5 Multiply Read A Print A=50 ...
http://rosettacode.org/wiki/Hello_world/Text
Hello world/Text
Hello world/Text is part of Short Circuit's Console Program Basics selection. Task Display the string Hello world! on a text console. Related tasks   Hello world/Graphical   Hello world/Line Printer   Hello world/Newbie   Hello world/Newline omission   Hello world/Standard error   Hello world/Web server
#Transact-SQL
Transact-SQL
PRINT "Hello world!"
http://rosettacode.org/wiki/Formal_power_series
Formal power series
A power series is an infinite sum of the form a 0 + a 1 ⋅ x + a 2 ⋅ x 2 + a 3 ⋅ x 3 + ⋯ {\displaystyle a_{0}+a_{1}\cdot x+a_{2}\cdot x^{2}+a_{3}\cdot x^{3}+\cdots } The ai are called the coefficients of the series. Such sums can be added, multiplied etc., where the new coefficients of ...
#C
C
#include <stdio.h> #include <stdlib.h> #include <math.h> /* for NaN */   enum fps_type { FPS_CONST = 0, FPS_ADD, FPS_SUB, FPS_MUL, FPS_DIV, FPS_DERIV, FPS_INT, };   typedef struct fps_t *fps; typedef struct fps_t { int type; fps s1, s2; dou...
http://rosettacode.org/wiki/Formatted_numeric_output
Formatted numeric output
Task Express a number in decimal as a fixed-length string with leading zeros. For example, the number   7.125   could be expressed as   00007.125.
#Ada
Ada
with Ada.Text_Io.Editing; use Ada.Text_Io.Editing; with Ada.Text_Io; use Ada.Text_Io;   procedure Zero_Fill is Pic_String: String := "<999999.99>"; Pic : Picture := To_Picture(Pic_String); type Money is delta 0.01 digits 8; package Money_Output is new Decimal_Output(Money); use Money_Output;   Value :...
http://rosettacode.org/wiki/Formatted_numeric_output
Formatted numeric output
Task Express a number in decimal as a fixed-length string with leading zeros. For example, the number   7.125   could be expressed as   00007.125.
#Aime
Aime
o_form("/w9s0/\n", 7.125); o_form("/w12d6p6/\n", -12.0625); o_form("/w12d6p6/\n", 7.125);
http://rosettacode.org/wiki/Four_is_the_number_of_letters_in_the_...
Four is the number of letters in the ...
The     Four is ...     sequence is based on the counting of the number of letters in the words of the (never─ending) sentence: Four is the number of letters in the first word of this sentence, two in the second, three in the third, six in the fourth, two in the fifth, seven in the sixth, ··· Definitions and...
#Mathematica.2FWolfram_Language
Mathematica/Wolfram Language
(*==Number names==*)   (*Mathematica has a built-in function for getting the name of an integer. It's a semantically rich function (dealing with many languages and grammatical variants), and consequently it would slow down our algorithm significantly. So, I've used the built-in function to seed/memoize special-purpose ...
http://rosettacode.org/wiki/Fork
Fork
Task Spawn a new process which can run simultaneously with, and independently of, the original parent process.
#Nim
Nim
import posix   var pid = fork() if pid < 0: echo "Error forking a child" elif pid > 0: echo "This is the parent process and its child has id ", pid, '.' # Further parent stuff. else: echo "This is the child process." # Further child stuff.
http://rosettacode.org/wiki/Fork
Fork
Task Spawn a new process which can run simultaneously with, and independently of, the original parent process.
#OCaml
OCaml
#load "unix.cma";; let pid = Unix.fork ();; if pid > 0 then print_endline "This is the original process" else print_endline "This is the new process";;
http://rosettacode.org/wiki/Function_definition
Function definition
A function is a body of code that returns a value. The value returned may depend on arguments provided to the function. Task Write a definition of a function called "multiply" that takes two arguments and returns their product. (Argument types should be chosen so as not to distract from showing how functions are ...
#M4
M4
define(`multiply',`eval($1*$2)')   multiply(2,3)
http://rosettacode.org/wiki/Hello_world/Text
Hello world/Text
Hello world/Text is part of Short Circuit's Console Program Basics selection. Task Display the string Hello world! on a text console. Related tasks   Hello world/Graphical   Hello world/Line Printer   Hello world/Newbie   Hello world/Newline omission   Hello world/Standard error   Hello world/Web server
#Transd
Transd
(textout "Hello, World!")
http://rosettacode.org/wiki/Formal_power_series
Formal power series
A power series is an infinite sum of the form a 0 + a 1 ⋅ x + a 2 ⋅ x 2 + a 3 ⋅ x 3 + ⋯ {\displaystyle a_{0}+a_{1}\cdot x+a_{2}\cdot x^{2}+a_{3}\cdot x^{3}+\cdots } The ai are called the coefficients of the series. Such sums can be added, multiplied etc., where the new coefficients of ...
#Clojure
Clojure
(defn ps+ [ps0 ps1] (letfn [(+zs [ps] (concat ps (repeat :z))) (notz? [a] (not= :z a)) (nval [a] (if (notz? a) a 0)) (z+ [a0 a1] (if (= :z a0 a1) :z (+ (nval a0) (nval a1))))] (take-while notz? (map z+ (+zs ps0) (+zs ps1)))))   (defn ps- [ps0 ps1] (ps+ ps0 (map - ps1)))
http://rosettacode.org/wiki/Formatted_numeric_output
Formatted numeric output
Task Express a number in decimal as a fixed-length string with leading zeros. For example, the number   7.125   could be expressed as   00007.125.
#ALGOL_68
ALGOL 68
main:( REAL r=exp(pi)-pi; print((r,newline)); printf(($g(-16,4)l$,-r)); printf(($g(-16,4)l$,r)); printf(($g( 16,4)l$,r)); printf(($g( 16,4,1)l$,r)); printf(($-dddd.ddddl$,-r)); printf(($-dddd.ddddl$,r)); printf(($+dddd.ddddl$,r)); printf(($ddddd.ddddl$,r)); printf(($zzzzd.ddddl$,r)); printf(($zz...
http://rosettacode.org/wiki/Four_is_the_number_of_letters_in_the_...
Four is the number of letters in the ...
The     Four is ...     sequence is based on the counting of the number of letters in the words of the (never─ending) sentence: Four is the number of letters in the first word of this sentence, two in the second, three in the third, six in the fourth, two in the fifth, seven in the sixth, ··· Definitions and...
#Nim
Nim
import strutils, strformat, tables   #################################################################################################### # Cardinal and ordinal strings.   const   Small = ["zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", ...
http://rosettacode.org/wiki/Four_is_the_number_of_letters_in_the_...
Four is the number of letters in the ...
The     Four is ...     sequence is based on the counting of the number of letters in the words of the (never─ending) sentence: Four is the number of letters in the first word of this sentence, two in the second, three in the third, six in the fourth, two in the fifth, seven in the sixth, ··· Definitions and...
#Perl
Perl
use feature 'state'; use Lingua::EN::Numbers qw(num2en num2en_ordinal);   my @sentence = split / /, 'Four is the number of letters in the first word of this sentence, ';   sub extend_to { my($last) = @_; state $index = 1; until ($#sentence > $last) { push @sentence, split ' ', num2en(alpha($sentence...
http://rosettacode.org/wiki/Fork
Fork
Task Spawn a new process which can run simultaneously with, and independently of, the original parent process.
#ooRexx
ooRexx
sub=.fork~new sub~sub Call syssleep 1 Do 3 Say 'program ' time() Call syssleep 1 End   ::class fork :: method sub Reply Do 6 Say 'subroutine' time() Call syssleep 1 End
http://rosettacode.org/wiki/Fork
Fork
Task Spawn a new process which can run simultaneously with, and independently of, the original parent process.
#Oz
Oz
declare ParentVar1 = "parent data" ParentVar2   functor RemoteCode export result:Result import QTk at 'x-oz://system/wp/QTk.ozf' define Result %% Show a simple window. When it is closed by the user, set Result. Window = {QTk.build td(action:proc {$} Result = 42 end %% on close...
http://rosettacode.org/wiki/Function_definition
Function definition
A function is a body of code that returns a value. The value returned may depend on arguments provided to the function. Task Write a definition of a function called "multiply" that takes two arguments and returns their product. (Argument types should be chosen so as not to distract from showing how functions are ...
#MAD
MAD
INTERNAL FUNCTION MULT.(A,B) = A * B
http://rosettacode.org/wiki/Hello_world/Text
Hello world/Text
Hello world/Text is part of Short Circuit's Console Program Basics selection. Task Display the string Hello world! on a text console. Related tasks   Hello world/Graphical   Hello world/Line Printer   Hello world/Newbie   Hello world/Newline omission   Hello world/Standard error   Hello world/Web server
#TransFORTH
TransFORTH
PRINT " Hello world! "
http://rosettacode.org/wiki/Formal_power_series
Formal power series
A power series is an infinite sum of the form a 0 + a 1 ⋅ x + a 2 ⋅ x 2 + a 3 ⋅ x 3 + ⋯ {\displaystyle a_{0}+a_{1}\cdot x+a_{2}\cdot x^{2}+a_{3}\cdot x^{3}+\cdots } The ai are called the coefficients of the series. Such sums can be added, multiplied etc., where the new coefficients of ...
#Common_Lisp
Common Lisp
(defpackage #:formal-power-series (:nicknames #:fps) (:use "COMMON-LISP") (:shadow #:+ #:- #:* #:/))   (in-package #:formal-power-series)
http://rosettacode.org/wiki/Formatted_numeric_output
Formatted numeric output
Task Express a number in decimal as a fixed-length string with leading zeros. For example, the number   7.125   could be expressed as   00007.125.
#AmigaE
AmigaE
PROC newRealF(es, fl, digit, len=0, zeros=TRUE) DEF s, t, i IF (len = 0) OR (len < (digit+3)) RETURN RealF(es, fl, digit) ELSE s := String(len) t := RealF(es, fl, digit) FOR i := 0 TO len-EstrLen(t)-1 DO StrAdd(s, IF zeros THEN '0' ELSE ' ') StrAdd(s, t) StrCopy(es, s) DisposeLink(s) ...
http://rosettacode.org/wiki/Four_is_the_number_of_letters_in_the_...
Four is the number of letters in the ...
The     Four is ...     sequence is based on the counting of the number of letters in the words of the (never─ending) sentence: Four is the number of letters in the first word of this sentence, two in the second, three in the third, six in the fourth, two in the fifth, seven in the sixth, ··· Definitions and...
#Phix
Phix
with javascript_semantics include demo\rosetta\number_names.exw -- see note -- as per Spelling_of_ordinal_numbers#Phix: constant {irregs,ordinals} = columnize({{"one","first"}, {"two","second"}, {"three","third"}, ...
http://rosettacode.org/wiki/Fork
Fork
Task Spawn a new process which can run simultaneously with, and independently of, the original parent process.
#PARI.2FGP
PARI/GP
void foo() { if (pari_daemon()) pari_printf("Original\n"); else pari_printf("Fork\n"); }
http://rosettacode.org/wiki/Fork
Fork
Task Spawn a new process which can run simultaneously with, and independently of, the original parent process.
#Perl
Perl
FORK: if ($pid = fork()) { # parent code } elsif (defined($pid)) { setsid; # tells apache to let go of this process and let it run solo # disconnect ourselves from input, output, and errors close(STDOUT); close(STDIN); close(STDERR); # re-open to /dev/null to prevent irrelevant warn mess...
http://rosettacode.org/wiki/Function_definition
Function definition
A function is a body of code that returns a value. The value returned may depend on arguments provided to the function. Task Write a definition of a function called "multiply" that takes two arguments and returns their product. (Argument types should be chosen so as not to distract from showing how functions are ...
#Make
Make
A=1 B=1   multiply: @expr $(A) \* $(B)
http://rosettacode.org/wiki/Hello_world/Text
Hello world/Text
Hello world/Text is part of Short Circuit's Console Program Basics selection. Task Display the string Hello world! on a text console. Related tasks   Hello world/Graphical   Hello world/Line Printer   Hello world/Newbie   Hello world/Newline omission   Hello world/Standard error   Hello world/Web server
#Trith
Trith
"Hello world!" print
http://rosettacode.org/wiki/Formal_power_series
Formal power series
A power series is an infinite sum of the form a 0 + a 1 ⋅ x + a 2 ⋅ x 2 + a 3 ⋅ x 3 + ⋯ {\displaystyle a_{0}+a_{1}\cdot x+a_{2}\cdot x^{2}+a_{3}\cdot x^{3}+\cdots } The ai are called the coefficients of the series. Such sums can be added, multiplied etc., where the new coefficients of ...
#D
D
  (require 'math) ;; converts a finite polynomial (a_0 a_1 .. a_n) to an infinite serie (a_0 ..a_n 0 0 0 ...) (define (poly->stream list) (make-stream (lambda(n) (cons (if (< n (length list)) (list-ref list n) 0) (1+ n))) 0))   ;; c = a + b , c_n = a_n + b_n (define (s-add a b) (make-stream (lambda (n) (cons (+ (str...
http://rosettacode.org/wiki/Formatted_numeric_output
Formatted numeric output
Task Express a number in decimal as a fixed-length string with leading zeros. For example, the number   7.125   could be expressed as   00007.125.
#APL
APL
'ZF15.9' ⎕FMT 7.125 00007.125000000
http://rosettacode.org/wiki/Formatted_numeric_output
Formatted numeric output
Task Express a number in decimal as a fixed-length string with leading zeros. For example, the number   7.125   could be expressed as   00007.125.
#ARM_Assembly
ARM Assembly
  /* ARM assembly Raspberry PI */ /* program formatNum.s */ /* use C library printf ha, ha, ha !!! */ /* Constantes */ .equ EXIT, 1 @ Linux syscall /* Initialized data */ .data szFormat1: .asciz " %09.3f\n" .align 4 sfNumber: .double 0f-7125E-3 sfNumber1: ...
http://rosettacode.org/wiki/Four_is_the_number_of_letters_in_the_...
Four is the number of letters in the ...
The     Four is ...     sequence is based on the counting of the number of letters in the words of the (never─ending) sentence: Four is the number of letters in the first word of this sentence, two in the second, three in the third, six in the fourth, two in the fifth, seven in the sixth, ··· Definitions and...
#Python
Python
  # Python implementation of Rosetta Code Task # http://rosettacode.org/wiki/Four_is_the_number_of_letters_in_the_... # Uses inflect # https://pypi.org/project/inflect/   import inflect   def count_letters(word): """ count letters ignore , or -, or space """ count = 0 for letter in word: if...
http://rosettacode.org/wiki/Fork
Fork
Task Spawn a new process which can run simultaneously with, and independently of, the original parent process.
#Phix
Phix
without js procedure mythread() ?"mythread" exit_thread(0) end procedure atom hThread = create_thread(routine_id("mythread"),{}) ?"main carries on" wait_thread(hThread)
http://rosettacode.org/wiki/Fork
Fork
Task Spawn a new process which can run simultaneously with, and independently of, the original parent process.
#PHP
PHP
<?php $pid = pcntl_fork(); if ($pid == 0) echo "This is the new process\n"; else if ($pid > 0) echo "This is the original process\n"; else echo "ERROR: Something went wrong\n"; ?>
http://rosettacode.org/wiki/Function_definition
Function definition
A function is a body of code that returns a value. The value returned may depend on arguments provided to the function. Task Write a definition of a function called "multiply" that takes two arguments and returns their product. (Argument types should be chosen so as not to distract from showing how functions are ...
#Maple
Maple
multiply:= (a, b) -> a * b;
http://rosettacode.org/wiki/Hello_world/Text
Hello world/Text
Hello world/Text is part of Short Circuit's Console Program Basics selection. Task Display the string Hello world! on a text console. Related tasks   Hello world/Graphical   Hello world/Line Printer   Hello world/Newbie   Hello world/Newline omission   Hello world/Standard error   Hello world/Web server
#True_BASIC
True BASIC
  ! In True BASIC all programs run in their own window. So this is almost a graphical version. PRINT "Hello world!" END  
http://rosettacode.org/wiki/Formal_power_series
Formal power series
A power series is an infinite sum of the form a 0 + a 1 ⋅ x + a 2 ⋅ x 2 + a 3 ⋅ x 3 + ⋯ {\displaystyle a_{0}+a_{1}\cdot x+a_{2}\cdot x^{2}+a_{3}\cdot x^{3}+\cdots } The ai are called the coefficients of the series. Such sums can be added, multiplied etc., where the new coefficients of ...
#EchoLisp
EchoLisp
  (require 'math) ;; converts a finite polynomial (a_0 a_1 .. a_n) to an infinite serie (a_0 ..a_n 0 0 0 ...) (define (poly->stream list) (make-stream (lambda(n) (cons (if (< n (length list)) (list-ref list n) 0) (1+ n))) 0))   ;; c = a + b , c_n = a_n + b_n (define (s-add a b) (make-stream (lambda (n) (cons (+ (str...
http://rosettacode.org/wiki/Formatted_numeric_output
Formatted numeric output
Task Express a number in decimal as a fixed-length string with leading zeros. For example, the number   7.125   could be expressed as   00007.125.
#Arturo
Arturo
r: 7.125   print r print to :string .format: "09.3f" r
http://rosettacode.org/wiki/Formatted_numeric_output
Formatted numeric output
Task Express a number in decimal as a fixed-length string with leading zeros. For example, the number   7.125   could be expressed as   00007.125.
#AutoHotkey
AutoHotkey
MsgBox % pad(7.25,7) ; 0007.25 MsgBox % pad(-7.25,7) ; -007.25   pad(x,len) { ; pad with 0's from left to len chars IfLess x,0, Return "-" pad(SubStr(x,2),len-1) VarSetCapacity(p,len,Asc("0")) Return SubStr(p x,1-len) }
http://rosettacode.org/wiki/Four_bit_adder
Four bit adder
Task "Simulate" a four-bit adder. This design can be realized using four 1-bit full adders. Each of these 1-bit full adders can be built with two half adders and an   or   gate. ; Finally a half adder can be made using an   xor   gate and an   and   gate. The   xor   gate can be made using two   nots,   two   ands ...
#11l
11l
F xor(a, b) R (a & !b) | (b & !a)   F ha(a, b) R (xor(a, b), a & b)   F fa(a, b, ci) V (s0, c0) = ha(ci, a) V (s1, c1) = ha(s0, b) R (s1, c0 | c1)   F fa4(a, b) V width = 4 V ci = [0B] * width V co = [0B] * width V s = [0B] * width L(i) 0 .< width (s[i], co[i]) = fa(a[i], b[i], I i !...
http://rosettacode.org/wiki/Four_is_the_number_of_letters_in_the_...
Four is the number of letters in the ...
The     Four is ...     sequence is based on the counting of the number of letters in the words of the (never─ending) sentence: Four is the number of letters in the first word of this sentence, two in the second, three in the third, six in the fourth, two in the fifth, seven in the sixth, ··· Definitions and...
#Raku
Raku
use Lingua::EN::Numbers; no-commas(True);   my $index = 1; my @sentence = flat 'Four is the number of letters in the first word of this sentence, '.words, { @sentence[$index++].&alpha.&cardinal, 'in', 'the', |($index.&ordinal ~ ',').words } ... * ;   sub alpha ( $str ) { $str.subst(/\W/, '', :g).chars } sub count ( $...
http://rosettacode.org/wiki/Fork
Fork
Task Spawn a new process which can run simultaneously with, and independently of, the original parent process.
#PicoLisp
PicoLisp
(unless (fork) # In child process (println *Pid) # Print the child's PID (bye) ) # and terminate
http://rosettacode.org/wiki/Fork
Fork
Task Spawn a new process which can run simultaneously with, and independently of, the original parent process.
#PL.2FI
PL/I
  ATTACH SOLVE (X) THREAD (T5);  
http://rosettacode.org/wiki/Function_definition
Function definition
A function is a body of code that returns a value. The value returned may depend on arguments provided to the function. Task Write a definition of a function called "multiply" that takes two arguments and returns their product. (Argument types should be chosen so as not to distract from showing how functions are ...
#Mathematica_.2F_Wolfram_Language
Mathematica / Wolfram Language
multiply[a_,b_]:=a*b