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/Higher-order_functions
Higher-order functions
Task Pass a function     as an argument     to another function. Related task   First-class functions
#Sparkling
Sparkling
function call_me(func, arg) { return func(arg); }   let answer = call_me(function(x) { return 6 * x; }, 7); print(answer);
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
#DBL
DBL
; ; Hello world for DBL version 4 by Dario B. ; PROC ;------------------------------------------------------------------ XCALL FLAGS (0007000000,1)  ;Suppress STOP message   OPEN (1,O,'TT:') WRITES (1,"Hello world")   DISPLAY (1,"Hello world...
http://rosettacode.org/wiki/Hello_world/Line_printer
Hello world/Line printer
Task Cause a line printer attached to the computer to print a line containing the message:   Hello World! Note A line printer is not the same as standard output. A   line printer   was an older-style printer which prints one line at a time to a continuous ream of paper. With some systems, a line printer can be...
#N.2Ft.2Froff
N/t/roff
  Hello World!  
http://rosettacode.org/wiki/Hello_world/Line_printer
Hello world/Line printer
Task Cause a line printer attached to the computer to print a line containing the message:   Hello World! Note A line printer is not the same as standard output. A   line printer   was an older-style printer which prints one line at a time to a continuous ream of paper. With some systems, a line printer can be...
#Nim
Nim
var lp = open("/dev/lp0", fmWrite) lp.writeln "Hello World" lp.close()
http://rosettacode.org/wiki/Hello_world/Line_printer
Hello world/Line printer
Task Cause a line printer attached to the computer to print a line containing the message:   Hello World! Note A line printer is not the same as standard output. A   line printer   was an older-style printer which prints one line at a time to a continuous ream of paper. With some systems, a line printer can be...
#OCaml
OCaml
let () = let oc = open_out "/dev/lp0" in output_string oc "Hello world!\n"; close_out oc ;;
http://rosettacode.org/wiki/Harshad_or_Niven_series
Harshad or Niven series
The Harshad or Niven numbers are positive integers ≥ 1 that are divisible by the sum of their digits. For example,   42   is a Harshad number as   42   is divisible by   (4 + 2)   without remainder. Assume that the series is defined as the numbers in increasing order. Task The task is to create a function/method/...
#ALGOL_68
ALGOL 68
BEGIN PROC digit sum = (INT i) INT : BEGIN INT res := i %* 10, h := i; WHILE (h %:= 10) > 0 DO res +:= h %* 10 OD; res END; INT found := 0; FOR i WHILE found < 20 DO (i %* digit sum (i) = 0 | found +:= 1; printf (($g(0)", "$, i)) ) OD; FOR i FROM 1001 DO (i %* digit sum ...
http://rosettacode.org/wiki/Hello_world/Newbie
Hello world/Newbie
Task Guide a new user of a language through the steps necessary to install the programming language and selection of a text editor if needed, to run the languages' example in the Hello world/Text task. Assume the language-newbie is a programmer in another language. Assume the language-newbie is competent in install...
#Axe
Axe
PROGRAM:MYPROGRM :.HELLO :Disp "HELLO, WORLD!",i
http://rosettacode.org/wiki/Hello_world/Newbie
Hello world/Newbie
Task Guide a new user of a language through the steps necessary to install the programming language and selection of a text editor if needed, to run the languages' example in the Hello world/Text task. Assume the language-newbie is a programmer in another language. Assume the language-newbie is competent in install...
#BASIC256
BASIC256
Print "HelloWorld!"
http://rosettacode.org/wiki/Hash_join
Hash join
An inner join is an operation that combines two data tables into one table, based on matching column values. The simplest way of implementing this operation is the nested loop join algorithm, but a more scalable alternative is the hash join algorithm. Task[edit] Implement the "hash join" algorithm, and demonstrate tha...
#D
D
import std.stdio, std.typecons;   auto hashJoin(size_t index1, size_t index2, T1, T2) (in T1[] table1, in T2[] table2) pure /*nothrow*/ @safe if (is(typeof(T1.init[index1]) == typeof(T2.init[index2]))) { // Hash phase. T1[][typeof(T1.init[index1])] h; foreach (const s; table1) h[s[index...
http://rosettacode.org/wiki/Higher-order_functions
Higher-order functions
Task Pass a function     as an argument     to another function. Related task   First-class functions
#Standard_ML
Standard ML
- fun func1 f = f "a string"; val func1 = fn : (string -> 'a) -> 'a - fun func2 s = "func2 called with " ^ s; val func2 = fn : string -> string   - print (func1 func2 ^ "\n"); func2 called with a string val it = () : unit
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
#Dc
Dc
[Hello world!]p
http://rosettacode.org/wiki/Hello_world/Line_printer
Hello world/Line printer
Task Cause a line printer attached to the computer to print a line containing the message:   Hello World! Note A line printer is not the same as standard output. A   line printer   was an older-style printer which prints one line at a time to a continuous ream of paper. With some systems, a line printer can be...
#Oforth
Oforth
File new("/dev/lp0") dup open(File.WRITE) "Hello world\n" << close
http://rosettacode.org/wiki/Hello_world/Line_printer
Hello world/Line printer
Task Cause a line printer attached to the computer to print a line containing the message:   Hello World! Note A line printer is not the same as standard output. A   line printer   was an older-style printer which prints one line at a time to a continuous ream of paper. With some systems, a line printer can be...
#Ol
Ol
  (define p (open-output-file "/dev/lp0")) (when p (print-to p "Hello world!") (close-port p))  
http://rosettacode.org/wiki/Hello_world/Line_printer
Hello world/Line printer
Task Cause a line printer attached to the computer to print a line containing the message:   Hello World! Note A line printer is not the same as standard output. A   line printer   was an older-style printer which prints one line at a time to a continuous ream of paper. With some systems, a line printer can be...
#OpenEdge.2FProgress
OpenEdge/Progress
OUTPUT TO PRINTER. PUT UNFORMATTED "Hello world!" SKIP. OUTPUT CLOSE.
http://rosettacode.org/wiki/Harshad_or_Niven_series
Harshad or Niven series
The Harshad or Niven numbers are positive integers ≥ 1 that are divisible by the sum of their digits. For example,   42   is a Harshad number as   42   is divisible by   (4 + 2)   without remainder. Assume that the series is defined as the numbers in increasing order. Task The task is to create a function/method/...
#ALGOL-M
ALGOL-M
begin integer function mod(a,b); integer a,b; mod := a-(a/b)*b;   integer function digitsum(n); integer n; digitsum := if n = 0 then 0 else mod(n,10) + digitsum(n/10);   integer function nextharshad(n); integer n; begin integer ds; loop: n := n + 1; ds := digitsum(n); if mod(n, ds) <> 0 then go ...
http://rosettacode.org/wiki/Hello_world/Newbie
Hello world/Newbie
Task Guide a new user of a language through the steps necessary to install the programming language and selection of a text editor if needed, to run the languages' example in the Hello world/Text task. Assume the language-newbie is a programmer in another language. Assume the language-newbie is competent in install...
#Befunge
Befunge
"!dlrow olleH">:#,_@
http://rosettacode.org/wiki/Hello_world/Newbie
Hello world/Newbie
Task Guide a new user of a language through the steps necessary to install the programming language and selection of a text editor if needed, to run the languages' example in the Hello world/Text task. Assume the language-newbie is a programmer in another language. Assume the language-newbie is competent in install...
#BQN
BQN
rlwrap ./BQN
http://rosettacode.org/wiki/Hash_join
Hash join
An inner join is an operation that combines two data tables into one table, based on matching column values. The simplest way of implementing this operation is the nested loop join algorithm, but a more scalable alternative is the hash join algorithm. Task[edit] Implement the "hash join" algorithm, and demonstrate tha...
#D.C3.A9j.C3.A0_Vu
Déjà Vu
hashJoin table1 index1 table2 index2: local :h {} # hash phase for s in table1: local :key s! index1 if not has h key: set-to h key [] push-to h! key s # join phase [] for r in table2: for s in copy h! r! index2: push-through swap [ s r ]  ...
http://rosettacode.org/wiki/Hash_join
Hash join
An inner join is an operation that combines two data tables into one table, based on matching column values. The simplest way of implementing this operation is the nested loop join algorithm, but a more scalable alternative is the hash join algorithm. Task[edit] Implement the "hash join" algorithm, and demonstrate tha...
#EchoLisp
EchoLisp
  (define ages '((27 "Jonah") (18 "Alan") (28 "Glory") (18 "Popeye") (28 "Alan"))) (define nemesis '(("Jonah" "Whales") ("Jonah" "Spiders") ("Alan" "Ghosts") ("Alan" "Zombies") ("Glory" "Buffy")))   ;; table: table name ;; source : input list ;; key-proc : procedure returning the join value ('name' in this task)   (def...
http://rosettacode.org/wiki/Higher-order_functions
Higher-order functions
Task Pass a function     as an argument     to another function. Related task   First-class functions
#SuperCollider
SuperCollider
f = { |x, y| x.(y) }; // a function that takes a function and calls it with an argument f.({ |x| x + 1 }, 5); // returns 5
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
#DCL
DCL
$ write sys$output "Hello world!"
http://rosettacode.org/wiki/Hash_from_two_arrays
Hash from two arrays
Task Using two Arrays of equal length, create a Hash object where the elements from one array (the keys) are linked to the elements of the other (the values) Related task   Associative arrays/Creation
#11l
11l
V keys = [‘a’, ‘b’, ‘c’] V values = [1, 2, 3] V hash_ = Dict(zip(keys, values)) print(hash_)
http://rosettacode.org/wiki/Hello_world/Line_printer
Hello world/Line printer
Task Cause a line printer attached to the computer to print a line containing the message:   Hello World! Note A line printer is not the same as standard output. A   line printer   was an older-style printer which prints one line at a time to a continuous ream of paper. With some systems, a line printer can be...
#Pascal
Pascal
program testprn; uses printer; var i: integer; f: text; begin writeln ( 'Test of printer unit' ); writeln ( 'Writing to lst ...' ); for i := 1 to 80 do writeln ( lst, 'This is line', i, '.' #13 ); close ( lst ); writeln ( 'Done.' ); {$ifdef Unix } writeln ( 'Writing to pipe ...' ); assignlst ( f...
http://rosettacode.org/wiki/Hello_world/Line_printer
Hello world/Line printer
Task Cause a line printer attached to the computer to print a line containing the message:   Hello World! Note A line printer is not the same as standard output. A   line printer   was an older-style printer which prints one line at a time to a continuous ream of paper. With some systems, a line printer can be...
#Perl
Perl
open O, ">", "/dev/lp0"; print O "Hello World!\n"; close O;
http://rosettacode.org/wiki/Harshad_or_Niven_series
Harshad or Niven series
The Harshad or Niven numbers are positive integers ≥ 1 that are divisible by the sum of their digits. For example,   42   is a Harshad number as   42   is divisible by   (4 + 2)   without remainder. Assume that the series is defined as the numbers in increasing order. Task The task is to create a function/method/...
#ALGOL_W
ALGOL W
begin % find members of the Harshad/Niven series - numbers divisible by the sum of their digits %  % returns the next member of the series above n  % integer procedure nextHarshad ( integer value n ) ; begin integer h, s; h := n; while begin ...
http://rosettacode.org/wiki/Hello_world/Newbie
Hello world/Newbie
Task Guide a new user of a language through the steps necessary to install the programming language and selection of a text editor if needed, to run the languages' example in the Hello world/Text task. Assume the language-newbie is a programmer in another language. Assume the language-newbie is competent in install...
#C
C
$ sudo apt-get install gcc
http://rosettacode.org/wiki/Hello_world/Newbie
Hello world/Newbie
Task Guide a new user of a language through the steps necessary to install the programming language and selection of a text editor if needed, to run the languages' example in the Hello world/Text task. Assume the language-newbie is a programmer in another language. Assume the language-newbie is competent in install...
#C.23
C#
#include <iostream> int main() { using namespace std; cout << "Hello, World!" << endl; return 0; }
http://rosettacode.org/wiki/Hash_join
Hash join
An inner join is an operation that combines two data tables into one table, based on matching column values. The simplest way of implementing this operation is the nested loop join algorithm, but a more scalable alternative is the hash join algorithm. Task[edit] Implement the "hash join" algorithm, and demonstrate tha...
#ECL
ECL
  LeftRec := RECORD UNSIGNED1 Age; STRING6 Name; END;   LeftFile := DATASET([{27,'Jonah'},{18,'Alan'},{28,'Glory'},{18,'Popeye'},{28,'Alan'}],LeftRec);   RightRec := RECORD STRING6 Name; STRING7 Nemesis; END;   RightFile := DATASET([{'Jonah','Whales'},{'Jonah','Spiders'},{'Alan','Ghosts'},{'Alan','Zombies...
http://rosettacode.org/wiki/Hash_join
Hash join
An inner join is an operation that combines two data tables into one table, based on matching column values. The simplest way of implementing this operation is the nested loop join algorithm, but a more scalable alternative is the hash join algorithm. Task[edit] Implement the "hash join" algorithm, and demonstrate tha...
#Elixir
Elixir
defmodule Hash do def join(table1, index1, table2, index2) do h = Enum.group_by(table1, fn s -> elem(s, index1) end) Enum.flat_map(table2, fn r -> Enum.map(h[elem(r, index2)], fn s -> {s, r} end) end) end end   table1 = [{27, "Jonah"}, {18, "Alan"}, {28, "Glory"}, {18...
http://rosettacode.org/wiki/Higher-order_functions
Higher-order functions
Task Pass a function     as an argument     to another function. Related task   First-class functions
#Swift
Swift
func func1(f: String->String) -> String { return f("a string") } func func2(s: String) -> String { return "func2 called with " + s } println(func1(func2)) // prints "func2 called with a string"
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
#DDNC
DDNC
  0 111 10 0 15 11 0 15 12 0 31 13 0 47 14 0 59 15 0 125 16 0 3 17 0 0 18 0 63 19 0 15 20 0 12 21 0 36 22 0 31 23 0 17 24   0 500 3 0 10 2 0 15 5   60 4 2 2 1 80 1 72 3 30 2 31 5 62 5 61 4 64  
http://rosettacode.org/wiki/Hash_from_two_arrays
Hash from two arrays
Task Using two Arrays of equal length, create a Hash object where the elements from one array (the keys) are linked to the elements of the other (the values) Related task   Associative arrays/Creation
#ActionScript
ActionScript
package { public class MyClass { public static function main():Void { var hash:Object = new Object(); var keys:Array = new Array("a", "b", "c"); var values:Array = new Array(1, 2, 3);   for (var i:int = 0; i < keys.length(); i++) ha...
http://rosettacode.org/wiki/Hash_from_two_arrays
Hash from two arrays
Task Using two Arrays of equal length, create a Hash object where the elements from one array (the keys) are linked to the elements of the other (the values) Related task   Associative arrays/Creation
#Ada
Ada
with Ada.Strings.Hash; with Ada.Containers.Hashed_Maps; with Ada.Text_Io; with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;   procedure Hash_Map_Test is function Equivalent_Key (Left, Right : Unbounded_String) return Boolean is begin return Left = Right; end Equivalent_Key;   function Hash_Func(K...
http://rosettacode.org/wiki/Hello_world/Line_printer
Hello world/Line printer
Task Cause a line printer attached to the computer to print a line containing the message:   Hello World! Note A line printer is not the same as standard output. A   line printer   was an older-style printer which prints one line at a time to a continuous ream of paper. With some systems, a line printer can be...
#Phix
Phix
integer fn = open(iff(platform()=WIN32?"PRN":"/dev/lp0"),"w") if fn=-1 then puts(1,"some error") else puts(fn,"Hello World!") close(fn) puts(1,"success!") end if {} = wait_key()
http://rosettacode.org/wiki/Hello_world/Line_printer
Hello world/Line printer
Task Cause a line printer attached to the computer to print a line containing the message:   Hello World! Note A line printer is not the same as standard output. A   line printer   was an older-style printer which prints one line at a time to a continuous ream of paper. With some systems, a line printer can be...
#PHP
PHP
<?php file_put_contents('/dev/lp0', 'Hello world!'); ?>
http://rosettacode.org/wiki/Harshad_or_Niven_series
Harshad or Niven series
The Harshad or Niven numbers are positive integers ≥ 1 that are divisible by the sum of their digits. For example,   42   is a Harshad number as   42   is divisible by   (4 + 2)   without remainder. Assume that the series is defined as the numbers in increasing order. Task The task is to create a function/method/...
#APL
APL
(20∘↑,¯1∘↑)∘((⊢,((+∘1)⍣((0=+/∘(⍎¨⍕)|⊢)⊣)⊃∘⌽))⍣(1∊1000<⊣)),1
http://rosettacode.org/wiki/Hello_world/Newbie
Hello world/Newbie
Task Guide a new user of a language through the steps necessary to install the programming language and selection of a text editor if needed, to run the languages' example in the Hello world/Text task. Assume the language-newbie is a programmer in another language. Assume the language-newbie is competent in install...
#C.2B.2B
C++
#include <iostream> int main() { using namespace std; cout << "Hello, World!" << endl; return 0; }
http://rosettacode.org/wiki/Hello_world/Newbie
Hello world/Newbie
Task Guide a new user of a language through the steps necessary to install the programming language and selection of a text editor if needed, to run the languages' example in the Hello world/Text task. Assume the language-newbie is a programmer in another language. Assume the language-newbie is competent in install...
#Clojure
Clojure
$ sudo apt-get install open-cobol
http://rosettacode.org/wiki/Hash_join
Hash join
An inner join is an operation that combines two data tables into one table, based on matching column values. The simplest way of implementing this operation is the nested loop join algorithm, but a more scalable alternative is the hash join algorithm. Task[edit] Implement the "hash join" algorithm, and demonstrate tha...
#Erlang
Erlang
  -module( hash_join ).   -export( [task/0] ).   task() -> Table_1 = [{27, "Jonah"}, {18, "Alan"}, {28, "Glory"}, {18, "Popeye"}, {28, "Alan"}], Table_2 = [{"Jonah", "Whales"}, {"Jonah", "Spiders"}, {"Alan", "Ghosts"}, {"Alan", "Zombies"}, {"Glory", "Buffy"}], Dict = lists:foldl( fun dict_append/2, dict:new...
http://rosettacode.org/wiki/Higher-order_functions
Higher-order functions
Task Pass a function     as an argument     to another function. Related task   First-class functions
#Tcl
Tcl
# this procedure executes its argument: proc demo {function} { $function } # for example: demo bell
http://rosettacode.org/wiki/Hello_world/Newline_omission
Hello world/Newline omission
Some languages automatically insert a newline after outputting a string, unless measures are taken to prevent its output. Task Display the string   Goodbye, World!   without a trailing newline. Related tasks   Hello world/Graphical   Hello world/Line Printer   Hello world/Standard error   Hello world/Text
#11l
11l
print(‘Goodbye, World!’, 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
#Delphi
Delphi
  program ProjectGoodbye; {$APPTYPE CONSOLE} begin WriteLn('Hello world!'); end.  
http://rosettacode.org/wiki/Hash_from_two_arrays
Hash from two arrays
Task Using two Arrays of equal length, create a Hash object where the elements from one array (the keys) are linked to the elements of the other (the values) Related task   Associative arrays/Creation
#Amazing_Hopper
Amazing Hopper
  #!/usr/bin/hopper #include <hopper.h>   main: new hash(h) add hash(h,"chile" :: 100) add hash(h,"argentina"::200) add hash(h,"brasil"::300) {"\nLongitud HASH: "},len hash(h),println println(hash(h))   println( get value("argentina",h) ) println( get value("chile",h) ) try println( get...
http://rosettacode.org/wiki/Hash_from_two_arrays
Hash from two arrays
Task Using two Arrays of equal length, create a Hash object where the elements from one array (the keys) are linked to the elements of the other (the values) Related task   Associative arrays/Creation
#Argile
Argile
use std, array, hash   let keys = @["hexadecimal" "decimal" "octal" "binary"] let values = @[0xa 11 014 0b1101] (: 10 11 12 13 :) let hash = new hash of int for each val int i from 0 to 3 hash[keys[i]] = values[i] del hash hash
http://rosettacode.org/wiki/Hello_world/Line_printer
Hello world/Line printer
Task Cause a line printer attached to the computer to print a line containing the message:   Hello World! Note A line printer is not the same as standard output. A   line printer   was an older-style printer which prints one line at a time to a continuous ream of paper. With some systems, a line printer can be...
#Picat
Picat
  main => Printer = open("/dev/lp0", write), println(Printer, "Hello, world!"), flush(Printer), close(Printer).  
http://rosettacode.org/wiki/Hello_world/Line_printer
Hello world/Line printer
Task Cause a line printer attached to the computer to print a line containing the message:   Hello World! Note A line printer is not the same as standard output. A   line printer   was an older-style printer which prints one line at a time to a continuous ream of paper. With some systems, a line printer can be...
#PicoLisp
PicoLisp
(out '(lpr "-P" "Printer01") (prinl "Hello world") )
http://rosettacode.org/wiki/Harshad_or_Niven_series
Harshad or Niven series
The Harshad or Niven numbers are positive integers ≥ 1 that are divisible by the sum of their digits. For example,   42   is a Harshad number as   42   is divisible by   (4 + 2)   without remainder. Assume that the series is defined as the numbers in increasing order. Task The task is to create a function/method/...
#AppleScript
AppleScript
on nextHarshad(n) if (n < 0) then set n to 0 repeat set n to n + 1 set temp to n set sum to 0 repeat until (temp is 0) set sum to sum + temp mod 10 set temp to temp div 10 end repeat if (n mod sum is 0) then return n end repeat end next...
http://rosettacode.org/wiki/Hello_world/Newbie
Hello world/Newbie
Task Guide a new user of a language through the steps necessary to install the programming language and selection of a text editor if needed, to run the languages' example in the Hello world/Text task. Assume the language-newbie is a programmer in another language. Assume the language-newbie is competent in install...
#COBOL
COBOL
$ sudo apt-get install open-cobol
http://rosettacode.org/wiki/Hello_world/Newbie
Hello world/Newbie
Task Guide a new user of a language through the steps necessary to install the programming language and selection of a text editor if needed, to run the languages' example in the Hello world/Text task. Assume the language-newbie is a programmer in another language. Assume the language-newbie is competent in install...
#Commodore_BASIC
Commodore BASIC
  10 PRINT "HELLO, WORLD!" 20 END  
http://rosettacode.org/wiki/Hash_join
Hash join
An inner join is an operation that combines two data tables into one table, based on matching column values. The simplest way of implementing this operation is the nested loop join algorithm, but a more scalable alternative is the hash join algorithm. Task[edit] Implement the "hash join" algorithm, and demonstrate tha...
#F.23
F#
[<EntryPoint>] let main argv = let table1 = [27, "Jonah"; 18, "Alan"; 28, "Glory"; 18, "Popeye"; 28, "Alan"] let table2 = ["Jonah", "Whales"; "Jonah", "Spiders"; "Alan", "Ghosts"; "Alan", "Zombies"; ...
http://rosettacode.org/wiki/Higher-order_functions
Higher-order functions
Task Pass a function     as an argument     to another function. Related task   First-class functions
#TI-89_BASIC
TI-89 BASIC
Local map Define map(f,l)=Func Return seq(#f(l[i]),i,1,dim(l)) EndFunc Disp map("sin", {0, π/6, π/4, π/3, π/2})
http://rosettacode.org/wiki/Hello_world/Newline_omission
Hello world/Newline omission
Some languages automatically insert a newline after outputting a string, unless measures are taken to prevent its output. Task Display the string   Goodbye, World!   without a trailing newline. Related tasks   Hello world/Graphical   Hello world/Line Printer   Hello world/Standard error   Hello world/Text
#68000_Assembly
68000 Assembly
PrintString: ;input: A0 = source address ;outputs to screen. MOVE.B (A0)+,D0 BEQ Terminated JSR PrintChar BRA PrintString Terminated: ; If this routine did in fact put a new line by default, it would do so here with the following: ; MOVE.B #13,D0  ;13 is ascii for Carriage Return (moves cursor back to beginning of row)...
http://rosettacode.org/wiki/Hello_world/Newline_omission
Hello world/Newline omission
Some languages automatically insert a newline after outputting a string, unless measures are taken to prevent its output. Task Display the string   Goodbye, World!   without a trailing newline. Related tasks   Hello world/Graphical   Hello world/Line Printer   Hello world/Standard error   Hello world/Text
#ACL2
ACL2
(cw "Goodbye, World!")
http://rosettacode.org/wiki/Hello_world/Newline_omission
Hello world/Newline omission
Some languages automatically insert a newline after outputting a string, unless measures are taken to prevent its output. Task Display the string   Goodbye, World!   without a trailing newline. Related tasks   Hello world/Graphical   Hello world/Line Printer   Hello world/Standard error   Hello world/Text
#Action.21
Action!
PROC Main() Print("Goodbye, World!") RETURN
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
#DeviousYarn
DeviousYarn
o:"Hello world!
http://rosettacode.org/wiki/Hash_from_two_arrays
Hash from two arrays
Task Using two Arrays of equal length, create a Hash object where the elements from one array (the keys) are linked to the elements of the other (the values) Related task   Associative arrays/Creation
#Arturo
Arturo
h: dictionary.raw flatten couple [a b c d] [1 2 3 4] print h
http://rosettacode.org/wiki/Hash_from_two_arrays
Hash from two arrays
Task Using two Arrays of equal length, create a Hash object where the elements from one array (the keys) are linked to the elements of the other (the values) Related task   Associative arrays/Creation
#AutoHotkey
AutoHotkey
array1 := ["two", "three", "apple"] array2 := [2, 3, "fruit"] hash := {} Loop % array1.maxIndex() hash[array1[A_Index]] := array2[A_Index] MsgBox % hash["apple"] "`n" hash["two"]
http://rosettacode.org/wiki/Hello_world/Line_printer
Hello world/Line printer
Task Cause a line printer attached to the computer to print a line containing the message:   Hello World! Note A line printer is not the same as standard output. A   line printer   was an older-style printer which prints one line at a time to a continuous ream of paper. With some systems, a line printer can be...
#PL.2FI
PL/I
  hello: procedure options(main); put skip list('Hello world.'); end hello;
http://rosettacode.org/wiki/Hello_world/Line_printer
Hello world/Line printer
Task Cause a line printer attached to the computer to print a line containing the message:   Hello World! Note A line printer is not the same as standard output. A   line printer   was an older-style printer which prints one line at a time to a continuous ream of paper. With some systems, a line printer can be...
#PostScript
PostScript
<</PageSize [595 842]>> setpagedevice  % set page size to DIN A4 /Courier findfont  % use Courier 12 scalefont setfont  % 12 pt 28 802 moveto  % 1 cm from the top and left edges (Hello world) show  % draw the string
http://rosettacode.org/wiki/Hello_world/Line_printer
Hello world/Line printer
Task Cause a line printer attached to the computer to print a line containing the message:   Hello World! Note A line printer is not the same as standard output. A   line printer   was an older-style printer which prints one line at a time to a continuous ream of paper. With some systems, a line printer can be...
#Prolog
Prolog
  :- initialization(main).   main :- open("/dev/lp0", write, Printer), writeln(Printer, "Hello, world!"), flush_output(Printer), close(Printer).  
http://rosettacode.org/wiki/Harshad_or_Niven_series
Harshad or Niven series
The Harshad or Niven numbers are positive integers ≥ 1 that are divisible by the sum of their digits. For example,   42   is a Harshad number as   42   is divisible by   (4 + 2)   without remainder. Assume that the series is defined as the numbers in increasing order. Task The task is to create a function/method/...
#Arturo
Arturo
harshad?: function [n] -> zero? n % sum digits n harshads: select 1..1100 => harshad?   print ["First 20 harshad numbers:" first.n:20 harshads]   loop harshads 'h [ if h > 1000 [ print ["First harshad > 1000:" h] break ] ]
http://rosettacode.org/wiki/Hello_world/Newbie
Hello world/Newbie
Task Guide a new user of a language through the steps necessary to install the programming language and selection of a text editor if needed, to run the languages' example in the Hello world/Text task. Assume the language-newbie is a programmer in another language. Assume the language-newbie is competent in install...
#Common_Lisp
Common Lisp
  (format t "Hello world!~%")  
http://rosettacode.org/wiki/Hello_world/Newbie
Hello world/Newbie
Task Guide a new user of a language through the steps necessary to install the programming language and selection of a text editor if needed, to run the languages' example in the Hello world/Text task. Assume the language-newbie is a programmer in another language. Assume the language-newbie is competent in install...
#Coq
Coq
= "Hello world!"%string  : string
http://rosettacode.org/wiki/Hello_world/Newbie
Hello world/Newbie
Task Guide a new user of a language through the steps necessary to install the programming language and selection of a text editor if needed, to run the languages' example in the Hello world/Text task. Assume the language-newbie is a programmer in another language. Assume the language-newbie is competent in install...
#Corescript
Corescript
import std.stdio;   void main() { writeln("Hello world!"); }
http://rosettacode.org/wiki/Hash_join
Hash join
An inner join is an operation that combines two data tables into one table, based on matching column values. The simplest way of implementing this operation is the nested loop join algorithm, but a more scalable alternative is the hash join algorithm. Task[edit] Implement the "hash join" algorithm, and demonstrate tha...
#Forth
Forth
  include FMS-SI.f include FMS-SILib.f   \ Since the same join attribute, Name, occurs more than once \ in both tables for this problem we need a hash table that \ will accept and retrieve multiple identical keys if we want \ an efficient solution for large tables. We make use \ of the hash collision handling feature o...
http://rosettacode.org/wiki/Hash_join
Hash join
An inner join is an operation that combines two data tables into one table, based on matching column values. The simplest way of implementing this operation is the nested loop join algorithm, but a more scalable alternative is the hash join algorithm. Task[edit] Implement the "hash join" algorithm, and demonstrate tha...
#Go
Go
package main   import "fmt"   func main() { tableA := []struct { value int key string }{ {27, "Jonah"}, {18, "Alan"}, {28, "Glory"}, {18, "Popeye"}, {28, "Alan"}, } tableB := []struct { key string value string }{ {"Jonah", "Whales"}, {"Jona...
http://rosettacode.org/wiki/Higher-order_functions
Higher-order functions
Task Pass a function     as an argument     to another function. Related task   First-class functions
#Toka
Toka
[ ." First\n" ] is first [ invoke ] is second ` first second
http://rosettacode.org/wiki/Hello_world/Newline_omission
Hello world/Newline omission
Some languages automatically insert a newline after outputting a string, unless measures are taken to prevent its output. Task Display the string   Goodbye, World!   without a trailing newline. Related tasks   Hello world/Graphical   Hello world/Line Printer   Hello world/Standard error   Hello world/Text
#Ada
Ada
  with Ada.Text_IO;   procedure Goodbye_World is begin Ada.Text_IO.Put("Goodbye, World!"); end Goodbye_World;  
http://rosettacode.org/wiki/Hello_world/Newline_omission
Hello world/Newline omission
Some languages automatically insert a newline after outputting a string, unless measures are taken to prevent its output. Task Display the string   Goodbye, World!   without a trailing newline. Related tasks   Hello world/Graphical   Hello world/Line Printer   Hello world/Standard error   Hello world/Text
#Agena
Agena
io.write( "Goodbye, World!" )
http://rosettacode.org/wiki/Hello_world/Newline_omission
Hello world/Newline omission
Some languages automatically insert a newline after outputting a string, unless measures are taken to prevent its output. Task Display the string   Goodbye, World!   without a trailing newline. Related tasks   Hello world/Graphical   Hello world/Line Printer   Hello world/Standard error   Hello world/Text
#ALGOL_68
ALGOL 68
BEGIN print ("Goodbye, World!") 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
#DIBOL-11
DIBOL-11
  START  ;Hello World   RECORD HELLO , A11, 'Hello World'   PROC XCALL FLAGS (0007000000,1)  ;Suppress STOP message   OPEN(8,O,'TT:') WRITES(8,HELLO) END    
http://rosettacode.org/wiki/Hash_from_two_arrays
Hash from two arrays
Task Using two Arrays of equal length, create a Hash object where the elements from one array (the keys) are linked to the elements of the other (the values) Related task   Associative arrays/Creation
#AWK
AWK
# usage: awk -v list1="i ii iii" -v list2="1 2 3" -f hash2.awk BEGIN { if(!list1) list1="one two three" if(!list2) list2="1 2 3"   split(list1, a); split(list2, b); for(i=1;i in a;i++) { c[a[i]] = b[i] };   for(i in c) print i,c[i] }
http://rosettacode.org/wiki/Hash_from_two_arrays
Hash from two arrays
Task Using two Arrays of equal length, create a Hash object where the elements from one array (the keys) are linked to the elements of the other (the values) Related task   Associative arrays/Creation
#BASIC256
BASIC256
DIM array1$(4) : array1$() = "0", "1", "2", "3", "4" DIM array2$(4) : array2$() = "zero", "one", "two", "three", "four"   FOR index% = 0 TO DIM(array1$(),1) PROCputdict(mydict$, array2$(index%), array1$(index%)) NEXT PRINT FNgetdict(mydict$, "3") END   DEF PROCputdict(R...
http://rosettacode.org/wiki/Hello_world/Line_printer
Hello world/Line printer
Task Cause a line printer attached to the computer to print a line containing the message:   Hello World! Note A line printer is not the same as standard output. A   line printer   was an older-style printer which prints one line at a time to a continuous ream of paper. With some systems, a line printer can be...
#PureBasic
PureBasic
MyPrinter$ = LPRINT_GetDefaultPrinter() If LPRINT_OpenPrinter(MyPrinter$) If LPRINT_StartDoc("Printing a RC-Task") LPRINT_Print(Chr(27) + "E") ; PCL reset for HP Printers LPRINT_PrintN("Hello World!") LPRINT_NewPage() LPRINT_EndDoc() EndIf LPRINT_ClosePrinter() EndIf
http://rosettacode.org/wiki/Hello_world/Line_printer
Hello world/Line printer
Task Cause a line printer attached to the computer to print a line containing the message:   Hello World! Note A line printer is not the same as standard output. A   line printer   was an older-style printer which prints one line at a time to a continuous ream of paper. With some systems, a line printer can be...
#Python
Python
lp = open("/dev/lp0") lp.write("Hello World!\n") lp.close()
http://rosettacode.org/wiki/Hello_world/Line_printer
Hello world/Line printer
Task Cause a line printer attached to the computer to print a line containing the message:   Hello World! Note A line printer is not the same as standard output. A   line printer   was an older-style printer which prints one line at a time to a continuous ream of paper. With some systems, a line printer can be...
#Racket
Racket
  #lang racket (define (print text)  ;; try lpr first (define lpr-exe (find-executable-path "lpr"))  ;; otherwise use a special file (if lpr-exe (with-input-from-string (~a text "\n") (λ() (void (system* lpr-exe)))) (with-output-to-file #:exists 'append (case (system-type) [(windows) "PRN"] [else "/...
http://rosettacode.org/wiki/Harshad_or_Niven_series
Harshad or Niven series
The Harshad or Niven numbers are positive integers ≥ 1 that are divisible by the sum of their digits. For example,   42   is a Harshad number as   42   is divisible by   (4 + 2)   without remainder. Assume that the series is defined as the numbers in increasing order. Task The task is to create a function/method/...
#AutoHotkey
AutoHotkey
H := [] n := 1   Loop n := (H[A_Index] := NextHarshad(n)) + 1 until H[H.MaxIndex()] > 1000   Loop, 20 Out .= H[A_Index] ", "   MsgBox, % Out ". . . " H[H.MaxIndex()]   NextHarshad(n) { Loop, { Loop, Parse, n sum += A_LoopField if (!Mod(n, sum)) return n n++, sum := "" } }
http://rosettacode.org/wiki/Hello_world/Newbie
Hello world/Newbie
Task Guide a new user of a language through the steps necessary to install the programming language and selection of a text editor if needed, to run the languages' example in the Hello world/Text task. Assume the language-newbie is a programmer in another language. Assume the language-newbie is competent in install...
#D
D
import std.stdio;   void main() { writeln("Hello world!"); }
http://rosettacode.org/wiki/Hello_world/Newbie
Hello world/Newbie
Task Guide a new user of a language through the steps necessary to install the programming language and selection of a text editor if needed, to run the languages' example in the Hello world/Text task. Assume the language-newbie is a programmer in another language. Assume the language-newbie is competent in install...
#EchoLisp
EchoLisp
  ;; This is a comment ;; Type in the following -uncommented- line in the input text area, and press [RETURN] ;; or click onto the "Eval" button ;; Auto-completion : You will notice that after "(di" , EchoLisp proposes "(display" : ;; Press the [TAB] key to accept   (display "Hello, World" "color:blue")  
http://rosettacode.org/wiki/Hash_join
Hash join
An inner join is an operation that combines two data tables into one table, based on matching column values. The simplest way of implementing this operation is the nested loop join algorithm, but a more scalable alternative is the hash join algorithm. Task[edit] Implement the "hash join" algorithm, and demonstrate tha...
#Groovy
Groovy
  def hashJoin(table1, col1, table2, col2) {   def hashed = table1.groupBy { s -> s[col1] }   def q = [] as Set   table2.each { r -> def join = hashed[r[col2]] join.each { s -> q << s.plus(r) } }   q }  
http://rosettacode.org/wiki/Higher-order_functions
Higher-order functions
Task Pass a function     as an argument     to another function. Related task   First-class functions
#Trith
Trith
: twice 2 times ; : hello "Hello, world!" print ; [hello] twice
http://rosettacode.org/wiki/Higher-order_functions
Higher-order functions
Task Pass a function     as an argument     to another function. Related task   First-class functions
#TXR
TXR
@(bind a @(let ((counter 0)) (mapcar (lambda (x y) (list (inc counter) x y)) '(a b c) '(t r s)))) @(output) @ (repeat) @ (rep)@a:@(last)@a@(end) @ (end) @(end)
http://rosettacode.org/wiki/Hello_world/Newline_omission
Hello world/Newline omission
Some languages automatically insert a newline after outputting a string, unless measures are taken to prevent its output. Task Display the string   Goodbye, World!   without a trailing newline. Related tasks   Hello world/Graphical   Hello world/Line Printer   Hello world/Standard error   Hello world/Text
#Arturo
Arturo
prints "Goodbye, World!"
http://rosettacode.org/wiki/Hello_world/Newline_omission
Hello world/Newline omission
Some languages automatically insert a newline after outputting a string, unless measures are taken to prevent its output. Task Display the string   Goodbye, World!   without a trailing newline. Related tasks   Hello world/Graphical   Hello world/Line Printer   Hello world/Standard error   Hello world/Text
#ATS
ATS
implement main0 () = print "Goodbye, World!"
http://rosettacode.org/wiki/Hello_world/Newline_omission
Hello world/Newline omission
Some languages automatically insert a newline after outputting a string, unless measures are taken to prevent its output. Task Display the string   Goodbye, World!   without a trailing newline. Related tasks   Hello world/Graphical   Hello world/Line Printer   Hello world/Standard error   Hello world/Text
#AutoHotkey
AutoHotkey
DllCall("AllocConsole") FileAppend, Goodbye`, World!, CONOUT$ ; No newline outputted MsgBox
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
#Diego
Diego
with_computer(comp1)_printer(lp1)_text(Hello World!);
http://rosettacode.org/wiki/Hash_from_two_arrays
Hash from two arrays
Task Using two Arrays of equal length, create a Hash object where the elements from one array (the keys) are linked to the elements of the other (the values) Related task   Associative arrays/Creation
#BBC_BASIC
BBC BASIC
DIM array1$(4) : array1$() = "0", "1", "2", "3", "4" DIM array2$(4) : array2$() = "zero", "one", "two", "three", "four"   FOR index% = 0 TO DIM(array1$(),1) PROCputdict(mydict$, array2$(index%), array1$(index%)) NEXT PRINT FNgetdict(mydict$, "3") END   DEF PROCputdict(R...
http://rosettacode.org/wiki/Hash_from_two_arrays
Hash from two arrays
Task Using two Arrays of equal length, create a Hash object where the elements from one array (the keys) are linked to the elements of the other (the values) Related task   Associative arrays/Creation
#Bracmat
Bracmat
two three apple:?arr1 & 2 3 fruit:?arr2 & new$hash:?H & whl ' ( !arr1:%?k ?arr1 & !arr2:%?v ?arr2 & (H..insert)$(!k.!v) ) & (H..forall)$out & ;  
http://rosettacode.org/wiki/Hello_world/Line_printer
Hello world/Line printer
Task Cause a line printer attached to the computer to print a line containing the message:   Hello World! Note A line printer is not the same as standard output. A   line printer   was an older-style printer which prints one line at a time to a continuous ream of paper. With some systems, a line printer can be...
#Raku
Raku
my $lp = open '/dev/lp0', :w; $lp.say: 'Hello World!'; $lp.close;
http://rosettacode.org/wiki/Hello_world/Line_printer
Hello world/Line printer
Task Cause a line printer attached to the computer to print a line containing the message:   Hello World! Note A line printer is not the same as standard output. A   line printer   was an older-style printer which prints one line at a time to a continuous ream of paper. With some systems, a line printer can be...
#REXX
REXX
/*REXX program prints a string to the (DOS) line printer via redirection to a printer.*/ $= 'Hello World!' /*define a string to be used for output*/ '@ECHO' $ ">PRN" /*stick a fork in it, we're all done. */
http://rosettacode.org/wiki/Hello_world/Line_printer
Hello world/Line printer
Task Cause a line printer attached to the computer to print a line containing the message:   Hello World! Note A line printer is not the same as standard output. A   line printer   was an older-style printer which prints one line at a time to a continuous ream of paper. With some systems, a line printer can be...
#Ring
Ring
  lp = fopen("/dev/lp0","w") fputs(lp,"Hello world!") fclose(lp)  
http://rosettacode.org/wiki/Harshad_or_Niven_series
Harshad or Niven series
The Harshad or Niven numbers are positive integers ≥ 1 that are divisible by the sum of their digits. For example,   42   is a Harshad number as   42   is divisible by   (4 + 2)   without remainder. Assume that the series is defined as the numbers in increasing order. Task The task is to create a function/method/...
#AWK
AWK
#!/usr/bin/awk -f BEGIN { k=0; n=0; printf("First twenty Harshad numbers are:\n "); while (k<20) { if (isharshad(++n)) { printf("%i ",n); ++k; } } n = 1000; while (!isharshad(++n)); printf("\nFirst Harshad number larger than 1000 is \n  %i\n",n); }   function isharshad(n) { s = 0; for (i=0; i<len...
http://rosettacode.org/wiki/Hello_world/Newbie
Hello world/Newbie
Task Guide a new user of a language through the steps necessary to install the programming language and selection of a text editor if needed, to run the languages' example in the Hello world/Text task. Assume the language-newbie is a programmer in another language. Assume the language-newbie is competent in install...
#EDSAC_order_code
EDSAC order code
  class APPLICATION create make feature make do print ("Hello World!") end end  
http://rosettacode.org/wiki/Hello_world/Newbie
Hello world/Newbie
Task Guide a new user of a language through the steps necessary to install the programming language and selection of a text editor if needed, to run the languages' example in the Hello world/Text task. Assume the language-newbie is a programmer in another language. Assume the language-newbie is competent in install...
#Eiffel
Eiffel
  class APPLICATION create make feature make do print ("Hello World!") end end  
http://rosettacode.org/wiki/Hash_join
Hash join
An inner join is an operation that combines two data tables into one table, based on matching column values. The simplest way of implementing this operation is the nested loop join algorithm, but a more scalable alternative is the hash join algorithm. Task[edit] Implement the "hash join" algorithm, and demonstrate tha...
#Haskell
Haskell
{-# LANGUAGE LambdaCase, TupleSections #-} import qualified Data.HashTable.ST.Basic as H import Data.Hashable import Control.Monad.ST import Control.Monad import Data.STRef   hashJoin :: (Eq k, Hashable k) => [t] -> (t -> k) -> [a] -> (a -> k) -> [(t, a)] hashJoin xs fx ys fy = runST $ do l <- newSTRef []...
http://rosettacode.org/wiki/Higher-order_functions
Higher-order functions
Task Pass a function     as an argument     to another function. Related task   First-class functions
#uBasic.2F4tH
uBasic/4tH
' Test passing a function to a function: Print FUNC(_FNtwo(_FNone, 10, 11)) End   ' Function to be passed: _FNone Param (2) : Return ((a@ + b@)^2)   ' Function taking a function as an argument: _FNtwo Param (3) : Return (FUNC(a@ (b@, c@)))
http://rosettacode.org/wiki/Hello_world/Newline_omission
Hello world/Newline omission
Some languages automatically insert a newline after outputting a string, unless measures are taken to prevent its output. Task Display the string   Goodbye, World!   without a trailing newline. Related tasks   Hello world/Graphical   Hello world/Line Printer   Hello world/Standard error   Hello world/Text
#AutoIt
AutoIt
  ConsoleWrite("Goodbye, World!")  
http://rosettacode.org/wiki/Hello_world/Newline_omission
Hello world/Newline omission
Some languages automatically insert a newline after outputting a string, unless measures are taken to prevent its output. Task Display the string   Goodbye, World!   without a trailing newline. Related tasks   Hello world/Graphical   Hello world/Line Printer   Hello world/Standard error   Hello world/Text
#AWK
AWK
  BEGIN { printf("Goodbye, World!") }  
http://rosettacode.org/wiki/Hello_world/Newline_omission
Hello world/Newline omission
Some languages automatically insert a newline after outputting a string, unless measures are taken to prevent its output. Task Display the string   Goodbye, World!   without a trailing newline. Related tasks   Hello world/Graphical   Hello world/Line Printer   Hello world/Standard error   Hello world/Text
#Axe
Axe
Disp "Goodbye, World!"
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
#DIV_Games_Studio
DIV Games Studio
  PROGRAM HELLOWORLD;   BEGIN   WRITE_TEXT(0,160,100,4,"HELLO WORLD!"); LOOP FRAME; END END