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/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
#Huginn
Huginn
#! /bin/sh exec huginn --no-argv -E "${0}" "${@}" #! huginn   main() { print( "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
#Icon_and_Unicon
Icon and Unicon
procedure main() writes("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
#IWBASIC
IWBASIC
  'In a window   DEF Win:WINDOW DEF Close:CHAR DEF ScreenSizeX,ScreenSizeY:UINT   GETSCREENSIZE(ScreenSizeX,ScreenSizeY)   OPENWINDOW Win,0,0,ScreenSizeX,ScreenSizeY,NULL,NULL,"Goodbye program",&MainHandler   PRINT Win,"Goodbye, World!" 'Prints in upper left corner of the window (position 0,0). PRINT Win," You won't ha...
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
#Ela
Ela
open monad io do putStrLn "Hello world!" ::: IO
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
#Jsish
Jsish
/* Hash from two arrays, in Jsish */ function hashTwo(k:array, v:array):object { var hash = {}; for (var i = 0; i < k.length; i++) hash[k[i]] = v[i]; return hash; }   ;hashTwo(['a','b','c'], [1,2,3]); ;hashTwo(['a','b'], [1,[2,4,8],3]); ;hashTwo(['a','b','c'], [1,2]); ;hashTwo([], []);   /* =!EXPECTSTART!= ...
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/...
#Draco
Draco
proc nonrec dsum(word n) word: word r; r := 0; while n ~= 0 do r := r + n % 10; n := n / 10 od; r corp   proc nonrec next_harshad(word n) word: while n := n + 1; n % dsum(n) ~= 0 do od; n corp   proc nonrec main() void: word n; byte i; write("...
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...
#SETL
SETL
setl '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...
#SimpleCode
SimpleCode
Transcript open. Transcript show: '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...
#Smalltalk
Smalltalk
Transcript open. Transcript show: 'Hello world'.
http://rosettacode.org/wiki/GUI/Maximum_window_dimensions
GUI/Maximum window dimensions
The task is to determine the maximum height and width of a window that can fit within the physical display area of the screen without scrolling. This is effectively the screen size (not the total desktop area, which could be bigger than the screen display area) in pixels minus any adjustments for window decorations an...
#Haskell
Haskell
import Graphics.UI.Gtk import Control.Monad (when) import Control.Monad.Trans (liftIO)   maximumWindowDimensions :: IO () maximumWindowDimensions = do -- initialize the internal state of the GTK toolkit initGUI -- create a window window <- windowNew -- quit the application when the window is closed ...
http://rosettacode.org/wiki/GUI/Maximum_window_dimensions
GUI/Maximum window dimensions
The task is to determine the maximum height and width of a window that can fit within the physical display area of the screen without scrolling. This is effectively the screen size (not the total desktop area, which could be bigger than the screen display area) in pixels minus any adjustments for window decorations an...
#Icon_and_Unicon
Icon and Unicon
link graphics   procedure main() # Window size   W := WOpen("canvas=hidden") dh := WAttrib("displayheight") dw := WAttrib("displaywidth") WClose(W)   write("The display size is w=",dw,", h=",dh) end
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
#BBC_BASIC
BBC BASIC
SYS "MessageBox", @hwnd%, "Goodbye, World!", "", 0
http://rosettacode.org/wiki/Happy_numbers
Happy numbers
From Wikipedia, the free encyclopedia: A happy number is defined by the following process: Starting with any positive integer, replace the number by the sum of the squares of its digits, and repeat the process until the number equals   1   (where it will stay),   or it loops endlessly in a cycle which does not inclu...
#11l
11l
F happy(=n) Set[Int] past L n != 1 n = sum(String(n).map(с -> Int(с)^2)) I n C past R 0B past.add(n) R 1B   print((0.<500).filter(x -> happy(x))[0.<8])
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...
#OCaml
OCaml
#load "unix.cma";; (* for sleep and gettimeofday; not needed for the signals stuff per se *)   let start = Unix.gettimeofday ();;   Sys.set_signal Sys.sigint (Sys.Signal_handle (fun _signum -> Printf.printf "Ran for %f seconds.\n" (Unix.gettimeofday () -. start); ...
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...
#Perl
Perl
  my $start = time; # seconds since epohc my $arlm=5; # every 5 seconds show how we're doing my $i;   $SIG{QUIT} = sub {print " Ran for ", time - $start, " seconds.\n"; die; }; $SIG{INT} = sub {print " Running for ", time - $start, " seconds.\n"; }; $SIG{ALRM} = sub {print " After $arlm seconds i= $i. Execu...
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...
#Ruby
Ruby
def hashJoin(table1, index1, table2, index2) # hash phase h = table1.group_by {|s| s[index1]} h.default = [] # join phase table2.collect {|r| h[r[index2]].collect {|s| [s, r]} }.flatten(1) end   table1 = [[27, "Jonah"], [18, "Alan"], [28, "Glory"], [18, "Popeye"], ...
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...
#clojure
clojure
  (defn haversine [{lon1 :longitude lat1 :latitude} {lon2 :longitude lat2 :latitude}] (let [R 6372.8 ; kilometers dlat (Math/toRadians (- lat2 lat1)) dlon (Math/toRadians (- lon2 lon1)) lat1 (Math/toRadians lat1) lat2 (Math/toRadians lat2) a (+ (* (Math/sin (/ dlat 2)) (Math/...
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
#J
J
'Goodbye, World!' 1!:3 <'/proc/self/fd/1' 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
#Jack
Jack
class Main { function void main () { do Output.printString("Goodbye, World!");und return; } }
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
#Janet
Janet
(prin "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
#elastiC
elastiC
package hello;   // Import the `basic' package import basic;   // Define a simple function function hello() { // Print hello world basic.print( "Hello world!\n" ); }   /* * Here we start to execute package code */   // Invoke the `hello' function hello();
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
#Julia
Julia
k = ["a", "b", "c"] v = [1, 2, 3]   Dict(ki => vi for (ki, vi) in zip(k, v))
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
#K
K
a: `zero `one `two / symbols b: 0 1 2   d:. a,'b / create the dictionary .((`zero;0;) (`one;1;) (`two;2;))   d[`one] 1
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/...
#EchoLisp
EchoLisp
  (define (harsh? n) (zero? (modulo n (apply + (map string->number (string->list (number->string n)))))))   (harsh? 42) → #t   (define H (stream-filter harsh? (in-naturals 1)))   (take H 20) → (1 2 3 4 5 6 7 8 9 10 12 18 20 21 24 27 30 36 40 42)   (for ((n H)) #:break (> n 1000) => n) → 1002  
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...
#smart_BASIC
smart BASIC
tar -xvf v11.1_linuxx64_expc.tar.gz
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...
#SQL_PL
SQL PL
tar -xvf v11.1_linuxx64_expc.tar.gz
http://rosettacode.org/wiki/GUI/Maximum_window_dimensions
GUI/Maximum window dimensions
The task is to determine the maximum height and width of a window that can fit within the physical display area of the screen without scrolling. This is effectively the screen size (not the total desktop area, which could be bigger than the screen display area) in pixels minus any adjustments for window decorations an...
#IWBASIC
IWBASIC
  DEF Win:WINDOW DEF Close:CHAR   DEF ScreenSizeX,ScreenSizeY:UINT DEF L,T,ClientWidth,ClientHeight:INT   GETSCREENSIZE(ScreenSizeX,ScreenSizeY)   OPENWINDOW Win,0,0,ScreenSizeX,ScreenSizeY,@MAXBOX|@MINBOX|@SIZE|@MAXIMIZED,NULL,"Get client area",&MainHandler   'Left and top are always zero for this function. GETCLIENTS...
http://rosettacode.org/wiki/GUI/Maximum_window_dimensions
GUI/Maximum window dimensions
The task is to determine the maximum height and width of a window that can fit within the physical display area of the screen without scrolling. This is effectively the screen size (not the total desktop area, which could be bigger than the screen display area) in pixels minus any adjustments for window decorations an...
#Java
Java
import java.awt.*; import javax.swing.JFrame;   public class Test extends JFrame {   public static void main(String[] args) { new Test(); }   Test() { Toolkit toolkit = Toolkit.getDefaultToolkit();   Dimension screenSize = toolkit.getScreenSize(); System.out.println("Physical...
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
#Beads
Beads
beads 1 program 'Goodbye World' calc main_init alert('Goodbye, World!')   draw main_draw draw_str('Goodbye, World!')
http://rosettacode.org/wiki/Happy_numbers
Happy numbers
From Wikipedia, the free encyclopedia: A happy number is defined by the following process: Starting with any positive integer, replace the number by the sum of the squares of its digits, and repeat the process until the number equals   1   (where it will stay),   or it loops endlessly in a cycle which does not inclu...
#8080_Assembly
8080 Assembly
flags: equ 2 ; 256-byte page in which to keep track of cycles puts: equ 9 ; CP/M print string bdos: equ 5 ; CP/M entry point org 100h lxi d,0108h ; D=current number to test, E=amount of numbers ;;; Is D happy? number: mvi a,1 ; We haven't seen any numbers yet, set flags to 1 lxi h,256*flags init: mov m,a inr l j...
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...
#Phix
Phix
without js allow_break(false) -- by default Ctrl C terminates the program puts(1,"Press Ctrl C\n") atom t = time() integer i = 1 while 1 do sleep(0.5) ?i if check_break() then exit end if i += 1 end while printf(1,"The program has run for %3.2f seconds\n",{time()-t})
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...
#PHP
PHP
<?php declare(ticks = 1);   $start = microtime(YES);   function mySigHandler() { global $start; $elapsed = microtime(YES) - $start; echo "Ran for $elapsed seconds.\n"; exit(); }   pcntl_signal(SIGINT, 'mySigHandler');   for ($n = 0; ; usleep(500000)) // 0.5 seconds echo ++$n, "\n"; ?>
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...
#Run_BASIC
Run BASIC
sqliteconnect #mem, ":memory:"   #mem execute("CREATE TABLE t_age(age,name)") #mem execute("CREATE TABLE t_name(name,nemesis)")   #mem execute("INSERT INTO t_age VALUES(27,'Jonah')") #mem execute("INSERT INTO t_age VALUES(18,'Alan')") #mem execute("INSERT INTO t_age VALUES(28,'Glory')") #mem execute("INSERT INTO t_age ...
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...
#CoffeeScript
CoffeeScript
haversine = (args...) -> R = 6372.8; # km radians = args.map (deg) -> deg/180.0 * Math.PI lat1 = radians[0]; lon1 = radians[1]; lat2 = radians[2]; lon2 = radians[3] dLat = lat2 - lat1 dLon = lon2 - lon1 a = Math.sin(dLat / 2) * Math.sin(dLat / 2) + Math.sin(dLon / 2) * Math.sin(dLon / 2) * Math.cos(lat1) *...
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
#Java
Java
public class HelloWorld { public static void main(String[] args) { System.out.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
#JavaScript
JavaScript
process.stdout.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
#Elena
Elena
public program() { 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
#Kotlin
Kotlin
// version 1.1.0   fun main(args: Array<String>) { val names = arrayOf("Jimmy", "Bill", "Barack", "Donald") val ages = arrayOf(92, 70, 55, 70) val hash = mapOf(*names.zip(ages).toTypedArray()) hash.forEach { println("${it.key.padEnd(6)} aged ${it.value}") } }
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/...
#Eiffel
Eiffel
  note description : "project application root class" date : "$October 10, 2014$" revision : "$Revision$"   class NIVEN_SERIES   create make   feature make local number : INTEGER count : INTEGER last : BOOLEAN do number := 1   from number := 1 last := false   until last...
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...
#Swift
Swift
tclsh8.5
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...
#Tcl
Tcl
tclsh8.5
http://rosettacode.org/wiki/GUI/Maximum_window_dimensions
GUI/Maximum window dimensions
The task is to determine the maximum height and width of a window that can fit within the physical display area of the screen without scrolling. This is effectively the screen size (not the total desktop area, which could be bigger than the screen display area) in pixels minus any adjustments for window decorations an...
#Julia
Julia
  win = GtkWindow("hello", 100, 100) fullscreen(win) sleep(10) println(width(win), " ", height(win)) destroy(win)  
http://rosettacode.org/wiki/GUI/Maximum_window_dimensions
GUI/Maximum window dimensions
The task is to determine the maximum height and width of a window that can fit within the physical display area of the screen without scrolling. This is effectively the screen size (not the total desktop area, which could be bigger than the screen display area) in pixels minus any adjustments for window decorations an...
#Kotlin
Kotlin
// version 1.1   import java.awt.Toolkit import javax.swing.JFrame   class Test : JFrame() { init { val r = Regex("""\[.*\]""") val toolkit = Toolkit.getDefaultToolkit() val screenSize = toolkit.screenSize println("Physical screen size : ${formatOutput(screenSize, r)}") val i...
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
#BML
BML
msgbox Goodbye, World!
http://rosettacode.org/wiki/Happy_numbers
Happy numbers
From Wikipedia, the free encyclopedia: A happy number is defined by the following process: Starting with any positive integer, replace the number by the sum of the squares of its digits, and repeat the process until the number equals   1   (where it will stay),   or it loops endlessly in a cycle which does not inclu...
#8th
8th
  : until! "not while!" eval i;   with: w with: n   : sumsqd \ n -- n 0 swap repeat 0; 10 /mod -rot sqr + swap again ;   : cycle \ n xt -- n >r dup r@ exec \ -- tortoise, hare repeat swap r@ exec swap r@ exec r@ exec 2dup = until! rdrop drop ;   : happy? ' sumsqd ...
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...
#PicoLisp
PicoLisp
#!/usr/bin/picolisp /usr/lib/picolisp/lib.l   (push '*Bye '(println (*/ (usec) 1000000)) '(prinl))   (let Cnt 0 (loop (println (inc 'Cnt)) (wait 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...
#PL.2FI
PL/I
  handler: procedure options (main); declare i fixed binary (31); declare (start_time, finish_time) float (18); on attention begin; finish_time = secs(); put skip list ('elapsed time =', finish_time - start_time, 'secs'); stop; end;   start_time = secs(); do i = 1 by 1; delay (...
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...
#Rust
Rust
use std::collections::HashMap; use std::hash::Hash;   // If you know one of the tables is smaller, it is best to make it the second parameter. fn hash_join<A, B, K>(first: &[(K, A)], second: &[(K, B)]) -> Vec<(A, K, B)> where K: Hash + Eq + Copy, A: Copy, B: Copy, { let mut hash_map = HashMap::new();   ...
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...
#Commodore_BASIC
Commodore BASIC
10 REM================================ 15 REM HAVERSINE FORMULA 20 REM 25 REM 2021-09-24 30 REM EN.WIKIPEDIA.ORG/WIKI/HAVERSINE_FORMULA 35 REM 40 REM C64 HAS PI CONSTANT 45 REM X1 LONGITUDE 1 50 REM Y1 LATITUDE 1 55 REM X2 LONGITUDE 2 60 REM Y2 LATITUDE 2 65 REM 70 REM V1, 2021-10-02, ALVALONGO 75 REM =================...
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
#jq
jq
$ jq -n -j '"Goodbye, World!"' 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
#Jsish
Jsish
printf("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
#Elisa
Elisa
"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
#Lang5
Lang5
: >table 2 compress -1 transpose ; ['one 'two 'three 'four] [1 2 3 4] >table
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/...
#Elixir
Elixir
defmodule Harshad do def series, do: Stream.iterate(1, &(&1+1)) |> Stream.filter(&(number?(&1)))   def number?(n), do: rem(n, digit_sum(n, 0)) == 0   defp digit_sum(0, sum), do: sum defp digit_sum(n, sum), do: digit_sum(div(n, 10), sum + rem(n, 10)) end   IO.inspect Harshad.series |> Enum.take(20)   IO.inspect ...
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...
#TI-83_BASIC
TI-83 BASIC
PROGRAM:MYPROGRM :Disp "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...
#TI-83_Hex_Assembly
TI-83 Hex Assembly
PROGRAM:HELLO :AsmPrgm :219F9D :EF0A45 :EF2E45 :C9 :48656C6C6F2C20576F726C642100
http://rosettacode.org/wiki/GUI/Maximum_window_dimensions
GUI/Maximum window dimensions
The task is to determine the maximum height and width of a window that can fit within the physical display area of the screen without scrolling. This is effectively the screen size (not the total desktop area, which could be bigger than the screen display area) in pixels minus any adjustments for window decorations an...
#Lingo
Lingo
put _system.desktopRectList -- [rect(0, 0, 1360, 768), rect(1360, 0, 2960, 1024)]
http://rosettacode.org/wiki/GUI/Maximum_window_dimensions
GUI/Maximum window dimensions
The task is to determine the maximum height and width of a window that can fit within the physical display area of the screen without scrolling. This is effectively the screen size (not the total desktop area, which could be bigger than the screen display area) in pixels minus any adjustments for window decorations an...
#M2000_Interpreter
M2000 Interpreter
  Module CheckAllMonitors { mode 16 ' font size i=-1 Flush Do { i++ Window mode, i Print Window=i Wait 100 Form ; ' expand Background to fill monitor (form without arguments cut that frame) if window=i Then { ...
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
#C
C
#include <gtk/gtk.h>   int main (int argc, char **argv) { GtkWidget *window; gtk_init(&argc, &argv);   window = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_window_set_title (GTK_WINDOW (window), "Goodbye, World"); g_signal_connect (G_OBJECT (window), "delete-event", gtk_main_quit, NULL); gtk_widget_show_all (...
http://rosettacode.org/wiki/GUI_enabling/disabling_of_controls
GUI enabling/disabling of controls
In addition to fundamental GUI component interaction, an application should dynamically enable and disable GUI components, to give some guidance to the user, and prohibit (inter)actions which are inappropriate in the current state of the application. Task Similar to the task GUI component interaction, write a progr...
#Ada
Ada
with Ada.Strings.Fixed; with Gtk.Main; with Gtk.Handlers; with Gtk.Button; with Gtk.Window; with Gtk.GEntry; with Gtk.Editable; with Gtk.Box; with Gtk.Widget; with Glib.Values;   procedure Disabling is type My_Natural is range 0 .. 10;   The_Value : My_Natural := 0;   Main_Window  : Gtk.Window.Gtk_Window; ...
http://rosettacode.org/wiki/Happy_numbers
Happy numbers
From Wikipedia, the free encyclopedia: A happy number is defined by the following process: Starting with any positive integer, replace the number by the sum of the squares of its digits, and repeat the process until the number equals   1   (where it will stay),   or it loops endlessly in a cycle which does not inclu...
#ACL2
ACL2
(include-book "arithmetic-3/top" :dir :system)   (defun sum-of-digit-squares (n) (if (zp n) 0 (+ (expt (mod n 10) 2) (sum-of-digit-squares (floor n 10)))))   (defun is-happy-r (n seen) (let ((next (sum-of-digit-squares n))) (cond ((= next 1) t) ((member next seen) nil...
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...
#PowerShell
PowerShell
  $Start_Time = (Get-date).second Write-Host "Type CTRL-C to Terminate..." $n = 1 Try { While($true) { Write-Host $n $n ++ Start-Sleep -m 500 } } Finally { $End_Time = (Get-date).second $Time_Diff = $End_Time - $Start_Time Write-Host "Total time in seconds"$Time_Diff }  
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...
#PureBasic
PureBasic
CompilerIf #PB_Compiler_OS<>#PB_OS_Windows CompilerError "This code is Windows only" CompilerEndIf   Global Quit, i, T0=ElapsedMilliseconds(), T1   Procedure CtrlC() T1=ElapsedMilliseconds() Quit=1 While i: Delay(1): Wend EndProcedure   If OpenConsole() SetConsoleCtrlHandler_(@CtrlC(),#True) While Not Q...
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...
#Scala
Scala
def join[Type](left: Seq[Seq[Type]], right: Seq[Seq[Type]]) = { val hash = right.groupBy(_.head) withDefaultValue Seq() left.flatMap(cols => hash(cols.last).map(cols ++ _.tail)) }   // Example:   val table1 = List(List("27", "Jonah"), List("18", "Alan"), List("28", "Glory"), ...
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...
#Common_Lisp
Common Lisp
(defparameter *earth-radius* 6372.8)   (defparameter *rad-conv* (/ pi 180))   (defun deg->rad (x) (* x *rad-conv*))   (defun haversine (x) (expt (sin (/ x 2)) 2))   (defun dist-rad (lat1 lng1 lat2 lng2) (let* ((hlat (haversine (- lat2 lat1))) (hlng (haversine (- lng2 lng1))) (root (sqrt (+ hlat ...
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
#Julia
Julia
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
#Kotlin
Kotlin
fun main(args: Array<String>) = 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
#Lasso
Lasso
stdout("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
#Elixir
Elixir
  IO.puts "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
#langur
langur
writeln toHash w/a b c d/, [1, 2, 3, 4]
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
#Lasso
Lasso
local( array1 = array('a', 'b', 'c'), array2 = array(1, 2, 3), hash = map )   loop(#array1 -> size) => { #hash -> insert(#array1 -> get(loop_count) = #array2 -> get(loop_count)) }   #hash
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/...
#Erlang
Erlang
  -module( harshad ).   -export( [greater_than/1, sequence/1, task/0] ).   greater_than( N ) when N >= 1 -> greater_than( 2, N, acc(1, {0, []}) ).   sequence( Find_this_many ) when Find_this_many >= 1 -> sequence( 2, Find_this_many, acc(1, {0, []}) ).   task() -> io:fwrite( "~p~n", [sequence(20...
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...
#Transd
Transd
  #lang transd   mainModule: { _start: (lambda (textout "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...
#Ultimate.2B.2B
Ultimate++
  #include <CtrlLib/CtrlLib.h> // submitted by Aykayayciti (Earl Lamont Montgomery)   using namespace Upp;   class GoodbyeWorld : public TopWindow { MenuBar menu; StatusBar status;   void FileMenu(Bar& bar); void MainMenu(Bar& bar); void About();   public: typedef GoodbyeWorld CLASSNAME;   GoodbyeWorld(); };   ...
http://rosettacode.org/wiki/GUI/Maximum_window_dimensions
GUI/Maximum window dimensions
The task is to determine the maximum height and width of a window that can fit within the physical display area of the screen without scrolling. This is effectively the screen size (not the total desktop area, which could be bigger than the screen display area) in pixels minus any adjustments for window decorations an...
#Mathematica_.2F_Wolfram_Language
Mathematica / Wolfram Language
Differences@Transpose@SystemInformation["Devices"][[1, 2, 1, 1, 2]] ->{{1260, 951}}
http://rosettacode.org/wiki/GUI/Maximum_window_dimensions
GUI/Maximum window dimensions
The task is to determine the maximum height and width of a window that can fit within the physical display area of the screen without scrolling. This is effectively the screen size (not the total desktop area, which could be bigger than the screen display area) in pixels minus any adjustments for window decorations an...
#Nim
Nim
import gtk2, gdk2   nim_init() var w = gdk2.screen_width() var h = gdk2.screen_height() echo("WxH=",w,"x",h)
http://rosettacode.org/wiki/GUI/Maximum_window_dimensions
GUI/Maximum window dimensions
The task is to determine the maximum height and width of a window that can fit within the physical display area of the screen without scrolling. This is effectively the screen size (not the total desktop area, which could be bigger than the screen display area) in pixels minus any adjustments for window decorations an...
#PARI.2FGP
PARI/GP
plothsizes()[1..2]
http://rosettacode.org/wiki/GUI/Maximum_window_dimensions
GUI/Maximum window dimensions
The task is to determine the maximum height and width of a window that can fit within the physical display area of the screen without scrolling. This is effectively the screen size (not the total desktop area, which could be bigger than the screen display area) in pixels minus any adjustments for window decorations an...
#Perl
Perl
  use strict; use warnings; use Tk;   sub get_size { my $mw = MainWindow->new(); return ($mw->maxsize); }  
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
#C.23
C#
using System; using System.Windows.Forms;   class Program { static void Main(string[] args) { Application.EnableVisualStyles(); //Optional. MessageBox.Show("Goodbye, World!"); } }
http://rosettacode.org/wiki/GUI_enabling/disabling_of_controls
GUI enabling/disabling of controls
In addition to fundamental GUI component interaction, an application should dynamically enable and disable GUI components, to give some guidance to the user, and prohibit (inter)actions which are inappropriate in the current state of the application. Task Similar to the task GUI component interaction, write a progr...
#AutoHotkey
AutoHotkey
GUI, Add, Edit, w150 number vValue gEnableDisable, 0 ; Number specifies a numbers-only edit field. g<Subroutine> specifies a subroutine to run when the value of control changes. GUI, Add, button,, Increment GUI, Add, button, xp+70 yp, Decrement ; xp+70 and yp are merely positioning options GUI, Show, w200 y200, Title ...
http://rosettacode.org/wiki/Happy_numbers
Happy numbers
From Wikipedia, the free encyclopedia: A happy number is defined by the following process: Starting with any positive integer, replace the number by the sum of the squares of its digits, and repeat the process until the number equals   1   (where it will stay),   or it loops endlessly in a cycle which does not inclu...
#Action.21
Action!
BYTE FUNC SumOfSquares(BYTE x) BYTE sum,d   sum=0 WHILE x#0 DO d=x MOD 10 d==*d sum==+d x==/10 OD RETURN (sum)   BYTE FUNC Contains(BYTE ARRAY a BYTE count,x) BYTE i   FOR i=0 TO count-1 DO IF a(i)=x THEN RETURN (1) FI OD RETURN (0)   BYTE FUNC IsHappyNumber(BYTE x) BYTE ARRAY ca...
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...
#Python
Python
import time   def counter(): n = 0 t1 = time.time() while True: try: time.sleep(0.5) n += 1 print n except KeyboardInterrupt, e: print 'Program has run for %5.3f seconds.' % (time.time() - t1) break   counter()
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...
#Racket
Racket
  #lang racket (define now current-milliseconds) (define start (now)) (with-handlers ([exn:break? (λ(x) (define elapsed (/ (- (now) start) 1000.)) (displayln (~a "Total time: " elapsed)))]) (for ([i (in-naturals)]) (displayln i) (sleep 0.5)))  
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...
#Scheme
Scheme
(use srfi-42)   (define ages '((27 Jonah) (18 Alan) (28 Glory) (18 Popeye) (28 Alan)))   (define nemeses '((Jonah Whales) (Jonah Spiders) (Alan Ghosts) (Alan Zombies) (Glory Buffy) (unknown nothing)))   (define hash (make-hash-table 'equal?))   (dolist (item ages) (hash-table-push!...
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...
#Crystal
Crystal
include Math   def haversine(lat1, lon1, lat2, lon2) r = 6372.8 # Earth radius in kilometers deg2rad = PI/180 # convert degress to radians   dLat = (lat2 - lat1) * deg2rad dLon = (lon2 - lon1) * deg2rad lat1 = lat1 * deg2rad lat2 = lat2 * deg2rad   a = sin(dLat / 2)**2 + cos(lat1) * ...
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
#LFE
LFE
  (io:format "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
#Liberty_BASIC
Liberty BASIC
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
#LIL
LIL
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
#Elm
Elm
main = text "Goodbye 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
#LFE
LFE
(let* ((keys (list 'foo 'bar 'baz)) (vals (list '"foo data" '"bar data" '"baz data")) (tuples (: lists zipwith (lambda (a b) (tuple a b)) keys vals)) (my-dict (: dict from_list tuples))) (: io format '"fetched data: ~p~n" (list (: dict fetch 'baz my-dict))))  
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
#Lingo
Lingo
keys = ["a","b","c"] values = [1,2,3]   props = [:] cnt = keys.count repeat with i = 1 to cnt props[keys[i]] = values[i] end repeat   put props -- ["a": 1, "b": 2, "c": 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/...
#Excel
Excel
nextHarshad =LAMBDA(n, UNTIL( LAMBDA(x, 0 = MOD(x, decDigitSum(x)) ) )( LAMBDA(x, 1 + x) )(1 + n) )   harshads =LAMBDA(n, UNTIL( LAMBDA(xs, n = ROWS(xs)) )( LAMBDA(xs, APPENDROWS(xs)( nextHarshad( IND...
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...
#Wren
Wren
System.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...
#X86-64_Assembly
X86-64 Assembly
Arch Linux : $ yay -S uasm or $ sudo pamac install uasm Other Distros: Use your package manager Windows: [http://www.terraspace.co.uk/uasm.html]
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...
#Zig
Zig
// - Install zig from https://ziglang.org/download/. // - Extract into your path // - `zig run newbie.zig` const std = @import("std");   pub fn main() void { // If you only want to quickly debug things and panic on failure, // you can use `debug.print` to print to standard error // Do not use debug code in ...
http://rosettacode.org/wiki/GUI/Maximum_window_dimensions
GUI/Maximum window dimensions
The task is to determine the maximum height and width of a window that can fit within the physical display area of the screen without scrolling. This is effectively the screen size (not the total desktop area, which could be bigger than the screen display area) in pixels minus any adjustments for window decorations an...
#Phix
Phix
include pGUI.e IupOpen() string scrnFullSize = IupGetGlobal("FULLSIZE") string scrnSize = IupGetGlobal("SCREENSIZE") string scrnMInfo = IupGetGlobal("MONITORSINFO") string scrnVScreen = IupGetGlobal("VIRTUALSCREEN") Ihandle dlg = IupDialog(NULL,"SIZE=FULL") string scrnXSize = IupGetAttribute(dlg,"MAXSIZE") ?{sc...
http://rosettacode.org/wiki/GUI/Maximum_window_dimensions
GUI/Maximum window dimensions
The task is to determine the maximum height and width of a window that can fit within the physical display area of the screen without scrolling. This is effectively the screen size (not the total desktop area, which could be bigger than the screen display area) in pixels minus any adjustments for window decorations an...
#PicoLisp
PicoLisp
(let Frame (java "javax.swing.JFrame" T "Window") (java Frame 'setExtendedState (java (public "javax.swing.JFrame" 'MAXIMIZED_BOTH)) ) (java Frame 'setVisible T) (wait 200) (let Size (java (java Frame 'getContentPane) 'getSize) (prinl "Width: " (java (public Size 'width))) (prinl "Height: ...
http://rosettacode.org/wiki/GUI/Maximum_window_dimensions
GUI/Maximum window dimensions
The task is to determine the maximum height and width of a window that can fit within the physical display area of the screen without scrolling. This is effectively the screen size (not the total desktop area, which could be bigger than the screen display area) in pixels minus any adjustments for window decorations an...
#Processing
Processing
  //Aamrun, 26th June 2022   fullScreen(); fill(0); textSize(50); text("Screen Height : " + str(height), 100, 100); text("Screen Width : " + str(width), 100, 200);  
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
#C.2B.2B
C++
#include <gtkmm.h> int main(int argc, char *argv[]) { Gtk::Main app(argc, argv); Gtk::MessageDialog msg("Goodbye, World!"); msg.run(); }
http://rosettacode.org/wiki/GUI_enabling/disabling_of_controls
GUI enabling/disabling of controls
In addition to fundamental GUI component interaction, an application should dynamically enable and disable GUI components, to give some guidance to the user, and prohibit (inter)actions which are inappropriate in the current state of the application. Task Similar to the task GUI component interaction, write a progr...
#BaCon
BaCon
OPTION GUI TRUE PRAGMA GUI gtk3   gui = GUIDEFINE(" \ { type=WINDOW name=window callback=delete-event title=\"Rosetta Code\" width-request=200 } \ { type=BOX name=box parent=window orientation=GTK_ORIENTATION_VERTICAL } \ { type=SPIN_BUTTON name=spin parent=box numeric=TRUE } \ { type=BUTTON_BOX name=bb...