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/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
#Brat
Brat
zip = { keys, values | h = [:] keys.each_with_index { key, index | h[key] = values[index] }   h }   p zip [1 2 3] [:a :b :c] #Prints [1: a, 2: b, 3: c]
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
#C
C
#include <stdio.h> #include <stdlib.h> #include <string.h>   #define KeyType const char * #define ValType int   #define HASH_SIZE 4096   // hash function useful when KeyType is char * (string) unsigned strhashkey( const char * key, int max) { unsigned h=0; unsigned hl, hr;   while(*key) { h += *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...
#RPG
RPG
  Fqsysprt O F 80 printer C except C seton LR Oqsysprt E O ...
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...
#Ruby
Ruby
open("| lpr", "w") { |f| f.puts "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...
#Run_BASIC
Run BASIC
shell$("echo \"Hello World!\" | lpr")
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/...
#Batch_File
Batch File
  @echo off setlocal enabledelayedexpansion   for /l %%i in (1,1,20) do ( call:harshad echo Harshad number %%i - !errorlevel! )   :loop call:harshad if %errorlevel% leq 1000 goto loop echo First Harshad number greater than 1000: %errorlevel% pause>nul exit /b   :harshad if "%harshadnum%"=="" set harshadnum=0 set /a...
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...
#Elena
Elena
public program() { console.writeLine("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...
#Erlang
Erlang
sudo apt-get install erlang
http://rosettacode.org/wiki/Harmonic_series
Harmonic series
This page uses content from Wikipedia. The original article was at Harmonic number. The list of authors can be seen in the page history. As with Rosetta Code, the text of Wikipedia is available under the GNU FDL. (See links for details on variance) In mathematics, the n-th harmonic number is the sum of the recipr...
#ALGOL_68
ALGOL 68
BEGIN # find some harmonic numbers, Hn is the sum if the reciprocals of 1..n # # returns the first n Harmonic numbers # OP HARMONIC = ( INT n )[]REAL: BEGIN [ 1 : n ]REAL h; h[ 1 ] := 1; FOR i FROM 2 TO n DO h[ i ] := h[ i - 1 ] + ( 1 / i ) ...
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...
#J
J
table1=: ;:;._2(0 :0) 27 Jonah 18 Alan 28 Glory 18 Popeye 28 Alan )   table2=: ;:;._2(0 :0) Jonah Whales Jonah Spiders Alan Ghosts Alan Zombies Glory Buffy )
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
#Ursa
Ursa
def first (function f) return (f) end   def second () return "second" end   out (first second) endl console # "second" is output to the console
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
#B
B
main() { putstr("Goodbye, World!"); return(0); }
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
#BASIC
BASIC
10 REM The trailing semicolon prevents a newline 20 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
#Batch_File
Batch File
<nul set/p"=Goodbye, World!" <nul set/p=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
#DM
DM
  /client/New() ..() src << "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
#C.23
C#
static class Program { static void Main() { System.Collections.Hashtable h = new System.Collections.Hashtable();   string[] keys = { "foo", "bar", "val" }; string[] values = { "little", "miss", "muffet" };   System.Diagnostics.Trace.Assert(keys.Length == values.Length, "Arrays ar...
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...
#Rust
Rust
use std::fs::OpenOptions; use std::io::Write;   fn main() { let file = OpenOptions::new().write(true).open("/dev/lp0").unwrap(); file.write(b"Hello, World!").unwrap(); }
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...
#Salmon
Salmon
open_output_text_file("/dev/lp0").print("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...
#Scala
Scala
import java.awt.print.PrinterException import scala.swing.TextArea   object LinePrinter extends App { val (show, context) = (false, "Hello, World!") try // Default Helvetica, 12p new TextArea(context) { append(" in printing.") peer.print(null, null, show, null, null, show) } catch { case e...
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/...
#BASIC
BASIC
10 DEFINT P,N,I,S 20 PRINT "First 20 Harshad numbers:" 30 P=0 40 N=0 50 N=N+1 60 S=0 70 I=N 80 S=S+I MOD 10 90 I=I\10 100 IF I THEN 80 110 IF N MOD S THEN 50 120 IF P<20 THEN P=P+1: PRINT N, 130 IF N<=1000 THEN 50 140 PRINT 150 PRINT "First Harshad number > 1000:";N
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...
#Factor
Factor
sudo apt-get install gfortran
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...
#Fortran
Fortran
sudo apt-get install gfortran
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...
#FutureBasic
FutureBasic
=== Your First Program ===
http://rosettacode.org/wiki/Harmonic_series
Harmonic series
This page uses content from Wikipedia. The original article was at Harmonic number. The list of authors can be seen in the page history. As with Rosetta Code, the text of Wikipedia is available under the GNU FDL. (See links for details on variance) In mathematics, the n-th harmonic number is the sum of the recipr...
#Arturo
Arturo
H: function [n][ sum map 1..n => reciprocal ]   firstAbove: function [lim][ i: 1 while ø [ if lim < to :floating H i -> return i i: i + 1 ] ]   print "The first 20 harmonic numbers:" print map 1..20 => H   print "" loop 1..4 'l [ print ["Position of first term >" l ":" f...
http://rosettacode.org/wiki/Harmonic_series
Harmonic series
This page uses content from Wikipedia. The original article was at Harmonic number. The list of authors can be seen in the page history. As with Rosetta Code, the text of Wikipedia is available under the GNU FDL. (See links for details on variance) In mathematics, the n-th harmonic number is the sum of the recipr...
#AWK
AWK
  # syntax: GAWK -f HARMONIC_SERIES.AWK # converted from FreeBASIC BEGIN { limit = 20 printf("The first %d harmonic numbers:\n",limit) for (n=1; n<=limit; n++) { h += 1/n printf("%2d %11.8f\n",n,h) } print("") h = 1 n = 2 for (i=2; i<=10; i++) { while (h < i) { ...
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...
#Java
Java
import java.util.*;   public class HashJoin {   public static void main(String[] args) { String[][] table1 = {{"27", "Jonah"}, {"18", "Alan"}, {"28", "Glory"}, {"18", "Popeye"}, {"28", "Alan"}};   String[][] table2 = {{"Jonah", "Whales"}, {"Jonah", "Spiders"}, {"Alan", "Ghosts"}, {"A...
http://rosettacode.org/wiki/Haversine_formula
Haversine formula
This page uses content from Wikipedia. The original article was at Haversine formula. The list of authors can be seen in the page history. As with Rosetta Code, the text of Wikipedia is available under the GNU FDL. (See links for details on variance) The haversine formula is an equation important in navigation, g...
#11l
11l
F haversine(=lat1, lon1, =lat2, lon2) V r = 6372.8 V dLat = radians(lat2 - lat1) V dLon = radians(lon2 - lon1) lat1 = radians(lat1) lat2 = radians(lat2) V a = sin(dLat / 2) ^ 2 + cos(lat1) * cos(lat2) * sin(dLon / 2) ^ 2 V c = 2 * asin(sqrt(a)) R r * c   print(haversine(36.12, -86.67, 33.94, -11...
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
#Ursala
Ursala
(autocomposition "f") "x" = "f" "f" "x"
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
#V
V
[first *].
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
#BBC_BASIC
BBC BASIC
REM BBC BASIC accepts the standard trailing semicolon: PRINT "Goodbye World!";   REM One could also output the characters individually: GW$ = "Goodbye World!" FOR i% = 1 TO LEN(GW$) VDU ASCMID$(GW$, i%) NEXT
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
#Bc
Bc
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
#beeswax
beeswax
_`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
#Draco
Draco
proc nonrec main() void: writeln("Hello world!") corp
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
#C.2B.2B
C++
#include <unordered_map> #include <string>   int main() { std::string keys[] = { "1", "2", "3" }; std::string vals[] = { "a", "b", "c" };   std::unordered_map<std::string, std::string> hash; for( int i = 0 ; i < 3 ; i++ ) hash[ keys[i] ] = vals[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
#Ceylon
Ceylon
shared void run() { value keys = [1, 2, 3]; value items = ['a', 'b', 'c']; value hash = map(zipEntries(keys, items)); }
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...
#Scheme
Scheme
(call-with-output-file "/dev/lp0"   (lambda (printer)     (write "Hello World!" 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...
#Seed7
Seed7
$ include "seed7_05.s7i";   const proc: main is func local var file: lp is STD_NULL; begin lp := open("/dev/lp0", "w"); writeln(lp, "Hello world!"); close(lp); end func;
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...
#Sidef
Sidef
Sys.open(\var fh, '>', '/dev/lp0') \ && fh.say("Hello World!") \ && fh.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/...
#BASIC256
BASIC256
  function sumDigitos(n) if n < 0 then return 0 suma = 0 while n > 0 suma = suma + (n mod 10) n = n \ 10 end while return suma end function   function isHarshad(n) return n mod sumDigitos(n) = 0 end function   print "Los primeros 20 números de Harshad o Niven son:" cuenta = 0 i = 1   do if isHarshad(i) then ...
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...
#Go
Go
$ cat >hello.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...
#Groovy
Groovy
println 'Hello to the Groovy 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...
#Haskell
Haskell
$ sudo apt-get install ghc
http://rosettacode.org/wiki/Harmonic_series
Harmonic series
This page uses content from Wikipedia. The original article was at Harmonic number. The list of authors can be seen in the page history. As with Rosetta Code, the text of Wikipedia is available under the GNU FDL. (See links for details on variance) In mathematics, the n-th harmonic number is the sum of the recipr...
#BASIC
BASIC
h = 0.0   print "The first twenty harmonic numbers are:" for n = 1 to 20 h += 1.0 / n print n, h next n print   h = 1 : n = 2 for i = 2 to 10 while h < i h += 1.0 / n n += 1 end while print "The first harmonic number greater than "; i; " is "; h; ", at position "; n-1 next i end
http://rosettacode.org/wiki/Harmonic_series
Harmonic series
This page uses content from Wikipedia. The original article was at Harmonic number. The list of authors can be seen in the page history. As with Rosetta Code, the text of Wikipedia is available under the GNU FDL. (See links for details on variance) In mathematics, the n-th harmonic number is the sum of the recipr...
#C.2B.2B
C++
#include <iomanip> #include <iostream> #include <boost/rational.hpp> #include <boost/multiprecision/gmp.hpp>   using integer = boost::multiprecision::mpz_int; using rational = boost::rational<integer>;   class harmonic_generator { public: rational next() { rational result = term_; term_ += rational(...
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...
#JavaScript
JavaScript
(() => { 'use strict';   // hashJoin :: [Dict] -> [Dict] -> String -> [Dict] let hashJoin = (tblA, tblB, strJoin) => {   let [jA, jB] = strJoin.split('='), M = tblB.reduce((a, x) => { let id = x[jB]; return ( a[id] ? a[id].push(x) : a[i...
http://rosettacode.org/wiki/Haversine_formula
Haversine formula
This page uses content from Wikipedia. The original article was at Haversine formula. The list of authors can be seen in the page history. As with Rosetta Code, the text of Wikipedia is available under the GNU FDL. (See links for details on variance) The haversine formula is an equation important in navigation, g...
#ABAP
ABAP
  DATA: X1 TYPE F, Y1 TYPE F, X2 TYPE F, Y2 TYPE F, YD TYPE F, PI TYPE F, PI_180 TYPE F, MINUS_1 TYPE F VALUE '-1'.   PI = ACOS( MINUS_1 ). PI_180 = PI / 180.   LATITUDE1 = 36,12 . LONGITUDE1 = -86,67 . LATITUDE2 = 33,94 . LONGITUDE2 = -118,4 .   X1 = LATITUDE1 * PI_180. Y1 = ...
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
#VBA
VBA
Sub HigherOrder() Dim result As Single result = first("second") MsgBox result End Sub Function first(f As String) As Single first = Application.Run(f, 1) + 2 End Function Function second(x As Single) As Single second = x / 2 End Function
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
#Befunge
Befunge
"!dlroW ,eybdooG">:#,_@
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
#Blade
Blade
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
#bootBASIC
bootBASIC
10 print "Goodbye, w"; 20 print "orld!";
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
#Dragon
Dragon
  showln "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
#Clojure
Clojure
(zipmap [\a \b \c] [1 2 3])
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
#Coco
Coco
keys = <[apple banana orange grape]> values = <[red yellow orange purple]>   object = new @[keys[i]] = values[i] for i til keys.length
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...
#Simula
Simula
BEGIN OUTTEXT("Hello World!"); OUTIMAGE END
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...
#Smalltalk
Smalltalk
s := PrinterStream defaultPrinter new. s nextPutLine:'Hello, world'. s 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...
#SNOBOL4
SNOBOL4
output = "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/...
#BBC_BASIC
BBC BASIC
I%=1:CNT%=0 WHILE TRUE IF FNHarshad(I%) THEN IF CNT%<20 PRINT ;I%;" ";:CNT%+=1 IF I%>1000 PRINT ;I%:EXIT WHILE ENDIF I%+=1 ENDWHILE END   DEF FNHarshad(num%) LOCAL sum%,tmp% tmp%=num% sum%=0 WHILE (tmp%>0) sum%+=tm...
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...
#J
J
'Goodbye, 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...
#Java
Java
javac -version
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...
#JavaScript
JavaScript
console.log("Hello, World!");
http://rosettacode.org/wiki/Harmonic_series
Harmonic series
This page uses content from Wikipedia. The original article was at Harmonic number. The list of authors can be seen in the page history. As with Rosetta Code, the text of Wikipedia is available under the GNU FDL. (See links for details on variance) In mathematics, the n-th harmonic number is the sum of the recipr...
#COBOL
COBOL
IDENTIFICATION DIVISION. PROGRAM-ID. HARMONIC.   DATA DIVISION. WORKING-STORAGE SECTION. 01 VARS. 03 N PIC 9(5) VALUE ZERO. 03 HN PIC 9(2)V9(12) VALUE ZERO. 03 INT PIC 99 VALUE ZERO. 01 OUT-VARS. 03 POS ...
http://rosettacode.org/wiki/Harmonic_series
Harmonic series
This page uses content from Wikipedia. The original article was at Harmonic number. The list of authors can be seen in the page history. As with Rosetta Code, the text of Wikipedia is available under the GNU FDL. (See links for details on variance) In mathematics, the n-th harmonic number is the sum of the recipr...
#Factor
Factor
USING: formatting grouping io kernel lists lists.lazy math math.functions math.ranges math.statistics math.text.english prettyprint sequences tools.memory.private ;   ! Euler-Mascheroni constant CONSTANT: γ 0.5772156649   : Hn-approx ( n -- ~Hn ) [ log γ + 1 2 ] [ * /f + 1 ] [ sq 12 * /f - ] tri ;   : lharmonics ( ...
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...
#jq
jq
# hashJoin(table1; key1; table2; key2) expects the two tables to be # arrays, either of JSON objects, or of arrays.   # In the first case, that is, if the table's rows are represented as # objects, then key1 should be the key of the join column of table1, # and similarly for key2; if the join columns have different nam...
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...
#Julia
Julia
using DataFrames   A = DataFrame(Age = [27, 18, 28, 18, 28], Name = ["Jonah", "Alan", "Glory", "Popeye", "Alan"]) B = DataFrame(Name = ["Jonah", "Jonah", "Alan", "Alan", "Glory"], Nemesis = ["Whales", "Spiders", "Ghosts", "Zombies", "Buffy"]) AB = join(A, B, on = :Name)   @show A B AB
http://rosettacode.org/wiki/Haversine_formula
Haversine formula
This page uses content from Wikipedia. The original article was at Haversine formula. The list of authors can be seen in the page history. As with Rosetta Code, the text of Wikipedia is available under the GNU FDL. (See links for details on variance) The haversine formula is an equation important in navigation, g...
#Ada
Ada
with Ada.Text_IO; use Ada.Text_IO; with Ada.Long_Float_Text_IO; use Ada.Long_Float_Text_IO; with Ada.Numerics.Generic_Elementary_Functions;   procedure Haversine_Formula is   package Math is new Ada.Numerics.Generic_Elementary_Functions (Long_Float); use Math;   -- Compute great circle distance, given latitude an...
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
#Visual_Basic_.NET
Visual Basic .NET
f=Add, f(6, 2) = 8 f=Mul, f(6, 2) = 12 f=Div, f(6, 2) = 3
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
#Bracmat
Bracmat
put$"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
#Brainf.2A.2A.2A
Brainf***
>+++++[>++++>+>+>++++>>+++<<<+<+<++[>++>+++>+++>++++>+>+[<]>>-]<-]>> +.>>+..<.--.++>>+.<<+.>>>-.>++.[<]++++[>++++<-]>.>>.+++.------.<-.[>]<+.[-] [G oo d b y e , W o r l d  !]
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
#DWScript
DWScript
  PrintLn('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
#CoffeeScript
CoffeeScript
  keys = ['a','b','c'] values = [1,2,3] map = {} map[key] = values[i] for key, i in keys  
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
#ColdFusion
ColdFusion
<cfscript> function makeHash(keyArray, valueArray) { var x = 1; var result = {}; for( ; x <= ArrayLen(keyArray); x ++ ) { result[keyArray[x]] = valueArray[x]; } return result; }   keyArray = ['a', 'b', 'c']; valueArray = [1, 2, 3]; map = makeHash(keyArray, valueArray); </cfscript>
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...
#Swift
Swift
import Foundation   let out = NSOutputStream(toFileAtPath: "/dev/lp0", append: true) let data = "Hello, World!".dataUsingEncoding(NSUTF8StringEncoding, allowLossyConversion: false) out?.open() out?.write(UnsafePointer<UInt8>(data!.bytes), maxLength: data!.length) out?.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...
#Tcl
Tcl
exec lp << "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...
#UNIX_Shell
UNIX Shell
# Use the default printer queue, with lp(1) or lpr(1). # 1. The system must have a printer queue. # 2. The printer queue must understand plain text. # 3. System V has lp(1). BSD has lpr(1). # CUPS has both lp(1) and lpr(1). # echo 'Hello World!' | lp echo 'Hello World!' | lpr   # Use a character device. # 1. Th...
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/...
#BCPL
BCPL
get "libhdr"   let dsum(n) = n=0 -> 0, n rem 10 + dsum(n/10) let next(n) = harshad(n+1) and harshad(n) = n rem dsum(n)=0 -> n, next(n)   let start() be $( let n = 0 writes("First 20:") for i = 1 to 20 do $( n := next(n) writef(" %N", n) $) writef("*NFirst above 1000: %N*N", next(1000)) $)
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...
#jq
jq
$ echo '"Hello world!"' | jq .   C:\ echo "Hello world!" | jq .
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...
#Julia
Julia
1. Use a web browser to go to http://juliabox.com. With email or Google signin, sign up for a free account. 1a.(optional) JuliaBox has Julia tutorials. You will find them in the default file directories when JuliaBox first loads. 1b. (optional) download and install Julia from https://julialang.org/ 2. Start a ...
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...
#Kotlin
Kotlin
notepad hello.kt
http://rosettacode.org/wiki/Harmonic_series
Harmonic series
This page uses content from Wikipedia. The original article was at Harmonic number. The list of authors can be seen in the page history. As with Rosetta Code, the text of Wikipedia is available under the GNU FDL. (See links for details on variance) In mathematics, the n-th harmonic number is the sum of the recipr...
#Forth
Forth
  warnings off   1.000.000.000.000.000 drop constant 1.0fx \ fractional part is 15 decimal digits.   : .h ( n -- ) s>d <# 14 for # next [char] . hold #s #> type space ;   1.0fx 1 2constant first-harmonic   : round 5 + 10 / ;   : next-harmonic ( h n -- h' n' ) 1+ tuck [ 1.0fx 10 * ] literal swap / round + s...
http://rosettacode.org/wiki/Harmonic_series
Harmonic series
This page uses content from Wikipedia. The original article was at Harmonic number. The list of authors can be seen in the page history. As with Rosetta Code, the text of Wikipedia is available under the GNU FDL. (See links for details on variance) In mathematics, the n-th harmonic number is the sum of the recipr...
#FreeBASIC
FreeBASIC
dim as double h = 0.0 dim as uinteger n, i   print "The first twenty harmonic numbers are:" for n = 1 to 20 h += 1.0/n print n, h next n   h = 1 : n = 2 for i=2 to 10 while h<i h+=1.0/n n+=1 wend print "The first harmonic number greater than ";i;" is ";h;", at position ";n-1 next i
http://rosettacode.org/wiki/Harmonic_series
Harmonic series
This page uses content from Wikipedia. The original article was at Harmonic number. The list of authors can be seen in the page history. As with Rosetta Code, the text of Wikipedia is available under the GNU FDL. (See links for details on variance) In mathematics, the n-th harmonic number is the sum of the recipr...
#Go
Go
package main   import ( "fmt" "math/big" )   func harmonic(n int) *big.Rat { sum := new(big.Rat) for i := int64(1); i <= int64(n); i++ { r := big.NewRat(1, i) sum.Add(sum, r) } return sum }   func main() { fmt.Println("The first 20 harmonic numbers and the 100th, expressed in...
http://rosettacode.org/wiki/Hello_world/Graphical
Hello world/Graphical
Task Display the string       Goodbye, World!       on a GUI object   (alert box, plain window, text area, etc.). Related task   Hello world/Text
#AArch64_Assembly
AArch64 Assembly
  /* ARM assembly AARCH64 Raspberry PI 3B */ /* program disMessGraph64.s */ /* link with gcc options -lX11 -L/usr/lpp/X11/lib */   /*******************************************/ /* Constantes file */ /*******************************************/ /* for this file see task include a file in lan...
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...
#Kotlin
Kotlin
data class A(val age: Int, val name: String)   data class B(val character: String, val nemesis: String)   data class C(val rowA: A, val rowB: B)   fun hashJoin(tableA: List<A>, tableB: List<B>): List<C> { val mm = tableB.groupBy { it.character } val tableC = mutableListOf<C>() for (a in tableA) { va...
http://rosettacode.org/wiki/Haversine_formula
Haversine formula
This page uses content from Wikipedia. The original article was at Haversine formula. The list of authors can be seen in the page history. As with Rosetta Code, the text of Wikipedia is available under the GNU FDL. (See links for details on variance) The haversine formula is an equation important in navigation, g...
#ALGOL_68
ALGOL 68
#!/usr/local/bin/a68g --script #   REAL r = 20 000/pi + 6.6 # km #, to rad = pi/180;   PROC dist = (REAL th1 deg, ph1 deg, th2 deg, ph2 deg)REAL: ( REAL ph1 = (ph1 deg - ph2 deg) * to rad, th1 = th1 deg * to rad, th2 = th2 deg * to rad,   dz = sin(th1) - sin(th2), dx ...
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
#Visual_Prolog
Visual Prolog
  domains intFunction = (integer In) -> integer Out procedure (i).   class predicates addone : intFunction. doTwice : (intFunction, integer) -> integer procedure (i, i).   clauses doTwice(Pred,X) = Y :- Y = Pred(Pred(X)).   addone(X) = Y := Y = X + 1.   run():- init(), write(dotwice(addone,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
#C
C
#include <stdio.h> #include <stdlib.h>   int main(int argc, char *argv[]) { (void) printf("Goodbye, World!"); /* No automatic newline */ return EXIT_SUCCESS; }
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
#C.23
C#
using System;   class Program { static void Main(string[] args) { //Using Console.WriteLine() will append a newline Console.WriteLine("Goodbye, World!");   //Using Console.Write() will not append a newline Console.Write("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
#Dyalect
Dyalect
print("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
#Common_Lisp
Common Lisp
(defun rosetta-code-hash-from-two-arrays (vector-1 vector-2 &key (test 'eql)) (assert (= (length vector-1) (length vector-2))) (let ((table (make-hash-table :test test :size (length vector-1)))) (map nil (lambda (k v) (setf (gethash k table) v)) vector-1 vector-2) table))
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
#Crystal
Crystal
keys = ('a'..'z').to_a # => a, b, c ... z vals = (1..26).to_a # => 1, 2, 3 ... 26   hash = Hash.zip(keys, vals) p 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...
#Wisp
Wisp
call-with-output-file "/dev/lp0" λ : printer write "Hello World!" 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...
#Wren
Wren
/* hello_world_line_printer.wren */   class C { foreign static lprint(s) }   C.lprint("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...
#X86_Assembly
X86 Assembly
;Assemble with: tasm, tlink /t ;assume direction bit is clear (so si increments) .model tiny .code org 100h start: mov si, offset msg ;point to message jmp pr20   pr10: mov ah, 0 ;write character to printer mov dx, 0 ;LPT1 int ...
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/...
#Befunge
Befunge
45*1>::01-\>:55+%\vv\0< >\1+^ + <|:/<+55<`  : ^_>1-\:.v@1>\:0\`#v_+\^ >^1\,+55<.^_:#%$:#<"}"v ^!:\_ ^###<  !`*8<
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...
#Lambdatalk
Lambdatalk
  The minimal installation is straightforward. Go to this URL:   - http://lambdaway.free.fr/lambdaspeech/?view=download   • 1) download the ~25kb archive, • 2) unzip the archive, you get a ~100kb folder named "archive", • 3) rename it for instance "my_wiki", avoiding spaces and esoteric characters, • 4) open your FT...
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...
#Locomotive_Basic
Locomotive Basic
10 print "Hello World!"
http://rosettacode.org/wiki/Harmonic_series
Harmonic series
This page uses content from Wikipedia. The original article was at Harmonic number. The list of authors can be seen in the page history. As with Rosetta Code, the text of Wikipedia is available under the GNU FDL. (See links for details on variance) In mathematics, the n-th harmonic number is the sum of the recipr...
#Haskell
Haskell
import Data.List (find) import Data.Ratio   --------------------- HARMONIC SERIES --------------------   harmonic :: [Rational] harmonic = scanl1 (\a x -> a + 1 / x) [1 ..]   -------------------------- TESTS ------------------------- main :: IO () main = do putStrLn "First 20 terms:" mapM_ putStrLn $ ...
http://rosettacode.org/wiki/Harmonic_series
Harmonic series
This page uses content from Wikipedia. The original article was at Harmonic number. The list of authors can be seen in the page history. As with Rosetta Code, the text of Wikipedia is available under the GNU FDL. (See links for details on variance) In mathematics, the n-th harmonic number is the sum of the recipr...
#jq
jq
# include "rational"; # a reminder   def harmonic: reduce range(1; 1+.) as $i ( r(0;1); radd(.; r(1; $i) ));   def lpad($len): tostring | ($len - length) as $l | (" " * $l)[:$l] + .;   def task1: "The first 20 harmonic numbers and the 100th, expressed in rational form, are:", (range(1;21), 100 | "\(.) : \(...
http://rosettacode.org/wiki/Hello_world/Graphical
Hello world/Graphical
Task Display the string       Goodbye, World!       on a GUI object   (alert box, plain window, text area, etc.). Related task   Hello world/Text
#Action.21
Action!
DEFINE PTR="CARD"   BYTE FUNC AtasciiToInternal(CHAR c) BYTE c2   c2=c&$7F IF c2<32 THEN RETURN (c+64) ELSEIF c2<96 THEN RETURN (c-32) FI RETURN (c)   PROC CharOut(CARD x BYTE y CHAR c) BYTE i,j,v PTR addr   addr=$E000+AtasciiToInternal(c)*8; FOR j=0 TO 7 DO v=Peek(addr) i=8 WHIL...
http://rosettacode.org/wiki/Handle_a_signal
Handle a signal
Most operating systems provide interrupt facilities, sometimes called signals either generated by the user or as a result of program failure or reaching a limit like file space. Unhandled signals generally terminate a program in a disorderly manner. Signal handlers are created so that the program behaves in a well-defi...
#Ada
Ada
with Ada.Interrupts; use Ada.Interrupts; with Ada.Interrupts.Names; use Ada.Interrupts.Names;   package Sigint_Handler is protected Handler is entry Wait; procedure Handle; pragma Interrupt_Handler(Handle); pragma Attach_Handler(Handle, Sigint); private Call_Count : Natural := ...