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_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...
#Lua
Lua
local function recA(age, name) return { Age=age, Name=name } end local tabA = { recA(27,"Jonah"), recA(18,"Alan"), recA(28,"Glory"), recA(18,"Popeye"), recA(28,"Alan") }   local function recB(character, nemesis) return { Character=character, Nemesis=nemesis } end local tabB = { recB("Jonah","Whales"), recB("Jonah","Spi...
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_W
ALGOL W
begin % compute the distance between places using the Haversine formula % real procedure arcsin( real value x ) ; arctan( x / sqrt( 1 - ( x * x ) ) ); real procedure distance ( real value th1Deg, ph1Deg, th2Deg, ph2Deg ) ; begin real ph1, th1, th2, toRad, dz, dx, dy; toRad := pi / 180; ...
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
#Wren
Wren
var first = Fn.new { |f| System.print("first function called") f.call() }   var second = Fn.new { System.print("second function called") }   first.call(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
#C.2B.2B
C++
#include <iostream>   int main() { std::cout << "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
#Clipper
Clipper
?? "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
#Clojure
Clojure
(print "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
#Dylan
Dylan
  module: hello-world   format-out("%s\n", "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
#D
D
void main() { import std.array, std.range;   immutable hash = ["a", "b", "c"].zip([1, 2, 3]).assocArray; }
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
#D.C3.A9j.C3.A0_Vu
Déjà Vu
local :h_keys [ :one :two :three ] local :h_values [ 1 2 3 ] local :h {} for item in h_keys: set-to h item pop-from h_values  
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...
#XPL0
XPL0
code Text=12; Text(2, "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/...
#BQN
BQN
SumDgt ← +´•Fmt-'0'˙ Niven ← 0=SumDgt|⊢ nivens ← Niven¨⊸/↕1100 ⟨20↑nivens, ⊑(⊢>1000˙)⊸/nivens⟩
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...
#Lua
Lua
io.write("Hello world, from ",_VERSION,"!\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...
#M2000_Interpreter
M2000 Interpreter
WINEPREFIX="$HOME/prefix32" WINEARCH=win32 wine wineboot
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...
#Maple
Maple
"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...
#Julia
Julia
const memoizer = [BigFloat(1.0), BigFloat(1.5)]   """ harmonic(n::Integer)::BigFloat Calculates harmonic numbers. The integer argument `n` should be positive. """ function harmonic(n::Integer)::BigFloat if n < 0 throw(DomainError(n)) elseif n == 0 return BigFloat(0.0) # by convention e...
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...
#Mathematica.2FWolfram_Language
Mathematica/Wolfram Language
nums = HarmonicNumber[Range[15000]]; nums[[;; 20]] LengthWhile[nums, LessEqualThan[#]] + 1 & /@ Range[10]
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...
#Nim
Nim
import strformat   iterator h(): (int, float) = ## Yield the index of the term and its value. var n = 1 var r = 0.0 while true: r += 1 / n yield (n, r) inc n   echo "First 20 terms of the harmonic series:" for (idx, val) in h(): echo &"{idx:2}: {val}" if idx == 20: break echo()   var target = 1....
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...
#PARI.2FGP
PARI/GP
h=0 for(n=1,20,h=h+1/n;print(n," ",h)) h=0; n=1 for(i=1,10,while(h<i,h=h+1/n;n=n+1);print(n-1))
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
#ActionScript
ActionScript
  var textField:TextField = new TextField(); stage.addChild(textField); textField.text = "Goodbye, World!"  
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...
#AutoHotkey
AutoHotkey
Start:=A_TickCount counter=0 SetTimer, timer, 500 return   timer: Send % ++Counter "`n" return   ^c:: SetTimer, timer, off SetFormat, float, 0.3 Send, % "Task took " (A_TickCount-Start)/1000 " Seconds" ExitApp return
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...
#BaCon
BaCon
' Handle signal SUB Finished SIGNAL SIG_DFL, SIGINT  : ' Restore SIGINT to default PRINT "Running for", TIMER / 1000.0, "seconds" FORMAT "%s %f %s\n" STOP SIGINT  : ' Send another terminating SIGINT ENDSUB   SIGNAL Finished, SIGINT iter = 1 WHILE TRUE SLEEP 500 PRINT iter iter = 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...
#LFE
LFE
  (defun hash (column table) (lists:foldl (lambda (x acc) (orddict:append (proplists:get_value column x) x acc)) '() table))   (defun get-hash (col hash-table) (proplists:get_value (proplists:get_value col r) hashed))   (defun merge (row-1 row-2) (orddict:merge (lambda (k v1 v2) v2...
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...
#AMPL
AMPL
  set location; set geo;   param coord{i in location, j in geo}; param dist{i in location, j in location};   data;   set location := BNA LAX; set geo := LAT LON;   param coord: LAT LON := BNA 36.12 -86.67 LAX 33.94 -118.4 ;   let dist['BNA','LAX'] := 2 * 6372.8 * asin (sqrt(sin...
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
#Z80_Assembly
Z80 Assembly
org &0040 ;Game Boy's vblank IRQ goes here. ;This is not part of the standard Z80 vector table - interrupts work differently on the Game Boy. jp &ff80   ;more code goes here   ;during setup, we'll CALL SetupDMA before enabling the vblank IRQ.     SetupDMA: ld bc,DMACopyEnd-DMACopy ;how many bytes to 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
#COBOL
COBOL
IDENTIFICATION DIVISION. PROGRAM-ID. GOODBYE-WORLD.   PROCEDURE DIVISION. DISPLAY 'Goodbye, World!' WITH NO ADVANCING END-DISPLAY . STOP RUN.
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
#CoffeeScript
CoffeeScript
process.stdout.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
#Common_Lisp
Common Lisp
(princ "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
#Dylan.NET
Dylan.NET
Console::WriteLine("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
#Delphi
Delphi
  program Hash_from_two_arrays;   {$APPTYPE CONSOLE}   uses System.SysUtils, System.Generics.Collections;   type THash = TDictionary<string, Integer>;   THashHelper = class helper for THash procedure AddItems(keys: TArray<string>; values: TArray<Integer>); end;   { THashHelper }   procedure THashHelper.Ad...
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/...
#C
C
#include <stdio.h>   static int digsum(int n) { int sum = 0; do { sum += n % 10; } while (n /= 10); return sum; }   int main(void) { int n, done, found;   for (n = 1, done = found = 0; !done; ++n) { if (n % digsum(n) == 0) { if (found++ < 20) printf("%d ", n); if (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...
#Mathematica_.2F_Wolfram_Language
Mathematica / Wolfram Language
print "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...
#MelonBasic
MelonBasic
print "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...
#MiniScript
MiniScript
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...
#Perl
Perl
use strict; use warnings; use feature 'say'; use Math::AnyNum ':overload'; use List::AllUtils 'firstidx';   my(@H,$n) = 0; do { ++$n and push @H, $H[-1] + 1/$n } until $H[-1] >= 10; shift @H;   say 'First twenty harmonic numbers as rationals:'; my $c = 0; printf("%20s", $_) and (not ++$c%5) and print "\n" for @H[0..19]...
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...
#Phix
Phix
requires("0.8.4") include mpfr.e integer n = 1, gn = 1, lim = iff(platform()=JS?8:10) mpq hn = mpq_init_set_si(1) sequence gt = {} puts(1,"First twenty harmonic numbers as rationals:\n") while gn<=lim do if n<=20 then printf(1,"%18s%s",{mpq_get_str(hn),iff(mod(n,5)?" ","\n")}) end if if n=100 then ...
http://rosettacode.org/wiki/Halt_and_catch_fire
Halt and catch fire
Task Create a program that crashes as soon as possible, with as few lines of code as possible. Be smart and don't damage your computer, ok? The code should be syntactically valid. It should be possible to insert [a subset of] your submission into another program, presumably to help debug it, or perhaps for use when an...
#11l
11l
assert(0B)
http://rosettacode.org/wiki/Halt_and_catch_fire
Halt and catch fire
Task Create a program that crashes as soon as possible, with as few lines of code as possible. Be smart and don't damage your computer, ok? The code should be syntactically valid. It should be possible to insert [a subset of] your submission into another program, presumably to help debug it, or perhaps for use when an...
#6502_Assembly
6502 Assembly
db $02
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
#Ada
Ada
with Gdk.Event; use Gdk.Event; with Gtk.Label; use Gtk.Label; with Gtk.Window; use Gtk.Window; with Gtk.Widget; use Gtk.Widget;   with Gtk.Handlers; with Gtk.Main;   procedure Windowed_Goodbye_World is Window : Gtk_Window; Label  : Gtk_Label;   package Handlers is new Gtk.Handlers.Callback (Gtk_Widget_Re...
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...
#BBC_BASIC
BBC BASIC
REM!Exefile C:\bbcsigint.exe,encrypt,console INSTALL @lib$+"CALLBACK" CTRL_C_EVENT = 0   SYS "GetStdHandle", -10 TO @hfile%(1) SYS "GetStdHandle", -11 TO @hfile%(2) *INPUT 13 *OUTPUT 14 ON ERROR PRINT REPORT$ : QUIT ERR   CtrlC% = FALSE handler% = FN_callback(...
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...
#C
C
#include <stdio.h> #include <stdlib.h> // for exit() #include <signal.h> #include <time.h> // for clock() #include <unistd.h> // for POSIX usleep()   volatile sig_atomic_t gotint = 0;   void handleSigint() { /* * Signal safety: It is not safe to call clock(), printf(), * or exit() inside a signal handler....
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...
#M2000_Interpreter
M2000 Interpreter
  Module HashJoin { \\ normally we define variables when we put values to names \\ so we can remove these two lines Def Name$, Nemesis$ Def Long m, mc, items_size, A   \\ Lets make a container which use keys with hash function Inventory A \\ A now is a pointer to an Inven...
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...
#Mathematica_.2F_Wolfram_Language
Mathematica / Wolfram Language
hashJoin[table1_List,table1colindex_Integer,table2_List,table2colindex_Integer]:=Module[{h,f,t1,t2,tmp}, t1=If[table1colindex != 1,table1[[All,Prepend[Delete[Range@Length@table1[[1]],table1colindex],table1colindex]]],table1]; t2=If[table2colindex != 1, table2[[All,Prepend[Delete[Range@Length@table2[[1]],table2colindex]...
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...
#APL
APL
r←6371 hf←{(p q)←○⍺ ⍵÷180 ⋄ 2×rׯ1○(+/(2*⍨1○(p-q)÷2)×1(×/2○⊃¨p q))*÷2} 36.12 ¯86.67 hf 33.94 ¯118.40
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
#zkl
zkl
fcn f(g){ g() } fcn g{ "Hello World!".println() }
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
#Creative_Basic
Creative Basic
  'In a window   DEF Win:WINDOW DEF Close:CHAR DEF ScreenSizeX,ScreenSizeY:INT   GETSCREENSIZE(ScreenSizeX,ScreenSizeY)   WINDOW Win,0,0,ScreenSizeX,ScreenSizeY,0,0,"Goodbye program",MainHandler   PRINT Win,"Goodbye, World!" 'Prints in the upper left corner of the window (position 0,0). PRINT"Win," I ride off into the ...
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
#D
D
import std.stdio;   void main() { 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
#Dc
Dc
[Goodbye, World!]P
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
#D.C3.A9j.C3.A0_Vu
Déjà Vu
!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
#E
E
def keys := ["one", "two", "three"] def values := [1, 2, 3] __makeMap.fromColumns(keys, values)
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
#EchoLisp
EchoLisp
  (lib 'hash)   (define H (make-hash)) (define keys '(elvis simon antoinette)) (define kvalues '("the king" "gallubert" "de gabolde d'Audan"))   (list->hash (map cons keys kvalues) H) → #hash:3 (hash-ref H 'elvis) → "the king"  
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/...
#C.23
C#
  using System; using System.Collections.Generic;   namespace Harshad { class Program { public static bool IsHarshad(int n) { char[] inputChars = n.ToString().ToCharArray(); IList<byte> digits = new List<byte>();   foreach (char digit in inputChars) ...
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...
#Monte
Monte
  def sayHello(): traceln("Hello World") sayHello()  
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...
#MontiLang
MontiLang
monti
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...
#Prolog
Prolog
main:- print_harmonic_series(20), nl, nth_harmonic_number(100, T), Num is numerator(T), Denom is denominator(T), writef('100th harmonic number: %t/%t\n', [Num, Denom]), nl, print_first_harmonic_greater_than(10).   print_harmonic_series(N):- writef('First %t harmonic numbers:\n', [N])...
http://rosettacode.org/wiki/Halt_and_catch_fire
Halt and catch fire
Task Create a program that crashes as soon as possible, with as few lines of code as possible. Be smart and don't damage your computer, ok? The code should be syntactically valid. It should be possible to insert [a subset of] your submission into another program, presumably to help debug it, or perhaps for use when an...
#8080_Assembly
8080 Assembly
di hlt
http://rosettacode.org/wiki/Halt_and_catch_fire
Halt and catch fire
Task Create a program that crashes as soon as possible, with as few lines of code as possible. Be smart and don't damage your computer, ok? The code should be syntactically valid. It should be possible to insert [a subset of] your submission into another program, presumably to help debug it, or perhaps for use when an...
#8086_Assembly
8086 Assembly
cli hlt
http://rosettacode.org/wiki/Halt_and_catch_fire
Halt and catch fire
Task Create a program that crashes as soon as possible, with as few lines of code as possible. Be smart and don't damage your computer, ok? The code should be syntactically valid. It should be possible to insert [a subset of] your submission into another program, presumably to help debug it, or perhaps for use when an...
#68000_Assembly
68000 Assembly
CrashBandicoot equ $100001 LEA CrashBandicoot,A0 MOVE.W (A0),D0
http://rosettacode.org/wiki/Halt_and_catch_fire
Halt and catch fire
Task Create a program that crashes as soon as possible, with as few lines of code as possible. Be smart and don't damage your computer, ok? The code should be syntactically valid. It should be possible to insert [a subset of] your submission into another program, presumably to help debug it, or perhaps for use when an...
#Ada
Ada
procedure Halt_And_Catch_Fire is begin raise Program_Error with "Halt and catch fire"; end Halt_And_Catch_Fire;
http://rosettacode.org/wiki/Halt_and_catch_fire
Halt and catch fire
Task Create a program that crashes as soon as possible, with as few lines of code as possible. Be smart and don't damage your computer, ok? The code should be syntactically valid. It should be possible to insert [a subset of] your submission into another program, presumably to help debug it, or perhaps for use when an...
#ALGOL_68
ALGOL 68
( print( ( 1 OVER 0 ) ) )
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
#ALGOL_68
ALGOL 68
  BEGIN FILE window; open (window, "Hello!", stand draw channel); draw device (window, "X", "600x400"); draw erase (window); draw move (window, 0.25, 0.5); draw colour (window, 1, 0, 0); draw text (window, "c", "c", "Goodbye, world!"); draw show (window); close (window) END  
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...
#C.23
C#
using System; //DateTime, Console, Environment classes class Program { static DateTime start; static void Main(string[] args) { start = DateTime.Now; //Add event handler for Ctrl+C command Console.CancelKeyPress += new ConsoleCancelEventHandler(Console_CancelKeyPress); int co...
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...
#C.2B.2B
C++
#include <chrono> #include <csignal> #include <ctime> #include <iostream> #include <thread>   volatile sig_atomic_t gotint = 0;   void handler(int signum) { // Set a flag for handling the signal, as other methods like printf are not safe here gotint = 1; }   int main() { using namespace std;   signal(SIGINT, handle...
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...
#Nim
Nim
import strformat, tables   type Data1 = tuple[value: int; key: string] Data2 = tuple[key: string; value: string]   proc `$`(d: Data1 | Data2): string = &"({d[0]}, {d[1]})"   iterator hashJoin(table1: openArray[Data1]; table2: openArray[Data2]): tuple[a: Data1; b: Data2] = # Hash phase. var h: Table[string, seq[...
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...
#Oberon-2
Oberon-2
  MODULE HashJoin; IMPORT ADT:Dictionary, ADT:LinkedList, NPCT:Tools, Object, Object:Boxed, Out; TYPE (* Some Aliases *) Age= Boxed.LongInt; Name= STRING; Nemesis= STRING;   (* Generic Tuple *) Tuple(E1: Object.Object; E2: Object.Object) = POINTER TO TupleDesc(E1,E2); TupleDesc(E1: Object.Obj...
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...
#AppleScript
AppleScript
use AppleScript version "2.4" -- Yosemite (10.10) or later use framework "Foundation" use framework "JavaScriptCore" use scripting additions   property js : missing value     -- haversine :: (Num, Num) -> (Num, Num) -> Num on haversine(latLong, latLong2) set {lat, lon} to latLong set {lat2, lon2} to latLong2   ...
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
#ZX_Spectrum_Basic
ZX Spectrum Basic
10 DEF FN f(f$,x,y)=VAL ("FN "+f$+"("+STR$ (x)+","+STR$ (y)+")") 20 DEF FN n(x,y)=(x+y)^2 30 PRINT FN f("n",10,11)
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
#Delphi
Delphi
program Project1;   {$APPTYPE CONSOLE}   begin Write('Goodbye, World!'); 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
#DWScript
DWScript
Print('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
#E
E
println("Hello world!")   stdout.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
#Elixir
Elixir
iex(1)> keys = [:one, :two, :three] [:one, :two, :three] iex(2)> values = [1, 2, 3] [1, 2, 3] iex(3)> Enum.zip(keys, values) |> Enum.into(Map.new) %{one: 1, three: 3, two: 2}
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
#Erlang
Erlang
  Dictionary = dict:from_list( lists:zip([key1, key2, key3], [value1, 2, 3]) ).  
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/...
#C.2B.2B
C++
#include <vector> #include <iostream>   int sumDigits ( int number ) { int sum = 0 ; while ( number != 0 ) { sum += number % 10 ; number /= 10 ; } return sum ; }   bool isHarshad ( int number ) { return number % ( sumDigits ( number ) ) == 0 ; }   int main( ) { std::vector<int> harshads ; ...
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...
#Nemerle
Nemerle
using System.Console; class Hello { static Main() : void { WriteLine("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...
#Nim
Nim
echo "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...
#Nix
Nix
print_string "Hello world!\n";;
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...
#Python
Python
from fractions import Fraction   def harmonic_series(): n, h = Fraction(1), Fraction(1) while True: yield h h += 1 / (n + 1) n += 1   if __name__ == '__main__': from itertools import islice for n, d in (h.as_integer_ratio() for h in islice(harmonic_series(), 20)): print(...
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...
#Quackery
Quackery
[ $ "bigrat.qky" loadfile ] now!   0 n->v 20 times [ i^ 1+ n->v 1/v v+ 2dup 20 point$ echo$ say " = " 2dup vulgar$ echo$ cr ] 2drop cr 1 temp put 0 n->v 1 [ dup dip [ n->v 1/v v+ temp share n->v 2over v< ] swap if [ temp share echo say " : " ...
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...
#R
R
HofN <- function(n) sum(1/seq_len(n)) #Task 1 H <- sapply(1:100000, HofN) print(H[1:20]) #Task 2 print(sapply(1:10, function(x) which.max(H > x))) #Task 3 and stretch
http://rosettacode.org/wiki/Halt_and_catch_fire
Halt and catch fire
Task Create a program that crashes as soon as possible, with as few lines of code as possible. Be smart and don't damage your computer, ok? The code should be syntactically valid. It should be possible to insert [a subset of] your submission into another program, presumably to help debug it, or perhaps for use when an...
#ALGOL_W
ALGOL W
assert false.
http://rosettacode.org/wiki/Halt_and_catch_fire
Halt and catch fire
Task Create a program that crashes as soon as possible, with as few lines of code as possible. Be smart and don't damage your computer, ok? The code should be syntactically valid. It should be possible to insert [a subset of] your submission into another program, presumably to help debug it, or perhaps for use when an...
#Arturo
Arturo
0/0
http://rosettacode.org/wiki/Halt_and_catch_fire
Halt and catch fire
Task Create a program that crashes as soon as possible, with as few lines of code as possible. Be smart and don't damage your computer, ok? The code should be syntactically valid. It should be possible to insert [a subset of] your submission into another program, presumably to help debug it, or perhaps for use when an...
#AWK
AWK
  # syntax: GAWK -f HALT_AND_CATCH_FIRE.AWK # # This won't halt the CPU but the program will crash immediately on startup # with "error: division by zero attempted". BEGIN { 1/0 } # # This will heat up the CPU, don't think it will catch on fire. BEGIN { while(1) {} } # # Under TAWK 5.0 using AWKW will immediately abort...
http://rosettacode.org/wiki/Halt_and_catch_fire
Halt and catch fire
Task Create a program that crashes as soon as possible, with as few lines of code as possible. Be smart and don't damage your computer, ok? The code should be syntactically valid. It should be possible to insert [a subset of] your submission into another program, presumably to help debug it, or perhaps for use when an...
#C
C
int main(){int a=0, b=0, c=a/b;}
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
#App_Inventor
App Inventor
display dialog "Goodbye, World!" buttons {"Bye"}
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...
#Clojure
Clojure
(require 'clojure.repl)   (def start (System/nanoTime))   (defn shutdown [_] (println "Received INT after" (/ (- (System/nanoTime) start) 1e9) "seconds.") (System/exit 0))   (clojure.repl/set-break-handler! shutdown)   (doseq [i (range)] (prn i) (Thread/sleep 500))
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...
#COBOL
COBOL
  identification division. program-id. signals. data division. working-storage section. 01 signal-flag pic 9 external. 88 signalled value 1. 01 half-seconds usage binary-long. 01 start-time usage binary-c-long. 01 end-time usage binary-c-long. ...
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...
#OCaml
OCaml
let hash_join table1 f1 table2 f2 = let h = Hashtbl.create 42 in (* hash phase *) List.iter (fun s -> Hashtbl.add h (f1 s) s) table1; (* join phase *) List.concat (List.map (fun r -> List.map (fun s -> s, r) (Hashtbl.find_all h (f2 r))) table2)
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...
#Arturo
Arturo
radians: function [x]-> x * pi // 180   haversine: function [src,tgt][ dLat: radians tgt\0 - src\0 dLon: radians tgt\1 - src\1 lat1: radians src\0 lat2: radians tgt\0   a: add product @[cos lat1, cos lat2, sin dLon/2, sin dLon/2] (sin dLat/2) ^ 2 c: 2 * asin sqrt a return 6372.8 * c ]   prin...
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
#Dyalect
Dyalect
print("Goodbye, World!", terminator: "")
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
#Dylan.NET
Dylan.NET
Console::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
#D.C3.A9j.C3.A0_Vu
Déjà Vu
!print\ "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
#EasyLang
EasyLang
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
#F.23
F#
HashMultiMap(Array.zip [|"foo"; "bar"; "baz"|] [|16384; 32768; 65536|], HashIdentity.Structural)
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
#Factor
Factor
USING: hashtables ; { "one" "two" "three" } { 1 2 3 } zip >hashtable
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/...
#Clojure
Clojure
(defn digsum [n acc] (if (zero? n) acc (digsum (quot n 10) (+ acc (mod n 10)))))   (let [harshads (filter #(zero? (mod % (digsum % 0))) (iterate inc 1))] (prn (take 20 harshads)) (prn (first (filter #(> % 1000) harshads))))
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...
#NS-HUBASIC
NS-HUBASIC
print_string "Hello world!\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...
#OCaml
OCaml
print_string "Hello world!\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...
#Oforth
Oforth
"Hello world!" println
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...
#Raku
Raku
use Lingua::EN::Numbers;   my @H = [\+] (1..*).map: { FatRat.new: 1, $_ };   say "First twenty harmonic numbers as rationals:\n", @H[^20]».&pretty-rat.batch(5)».fmt("%18s").join: "\n";   put "\nOne Hundredth:\n", pretty-rat @H[99];   say "\n(zero based) Index of first value:"; printf " greater than %2d: %6s (%s te...
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...
#REXX
REXX
/*REXX pgm to calculate N numbers (sums) in the harmonic series and also when they > X. */ parse arg digs sums high ints /*obtain optional arguments from the CL*/ if digs='' | digs="," then digs= 80 /*Not specified? Then use the default.*/ if sums='' | sums="," then sums= 20 ...
http://rosettacode.org/wiki/Halt_and_catch_fire
Halt and catch fire
Task Create a program that crashes as soon as possible, with as few lines of code as possible. Be smart and don't damage your computer, ok? The code should be syntactically valid. It should be possible to insert [a subset of] your submission into another program, presumably to help debug it, or perhaps for use when an...
#C.2B.2B
C++
#include <stdexcept> int main() { throw std::runtime_error("boom"); }