diff --git a/Lang/ALGOL-68/00DESCRIPTION b/Lang/ALGOL-68/00DESCRIPTION
index 663d797e6f..25aef9e3ca 100644
--- a/Lang/ALGOL-68/00DESCRIPTION
+++ b/Lang/ALGOL-68/00DESCRIPTION
@@ -29,21 +29,24 @@ The grammar for ALGOL 68 is officially in the two level, [[wp:Van Wijngaarden gr
* [http://www.softwarepreservation.org/projects/ALGOL/book/Lindsey_van_der_Meulen-IItA68-Revised-SyntaxOnly.pdf/view Syntax Chart (Size 516.6 kB - File type application/pdf)]
==Resources==
-* ALGOL BULLETIN - March 1959 to August 1988, in 52 issues[http://archive.computerhistory.org/resources/text/algol/algol_bulletin/]
+* ALGOL BULLETIN - March 1959 to August 1988, in 52 issues[http://archive.computerhistory.org/resources/text/algol/algol_bulletin]
* Algol68 mailinglist - December 2008 - algol68-user AT lists.sourceforge.net[https://lists.sourceforge.net/lists/listinfo/algol68-user]
+* Algol68 group at linked: [http://www.linkedin.com/groups/Algol68-2333923] - includes various famous compiler composers.
FYI: There are two online manual pages:
-* [https://sourceforge.net/projects/algol68/files/algol68g/algol68g-1.18.0/a68g-doc.pdf/download Algol 68G Manual - By Marcel van der Veer]
+* [http://jmvdveer.home.xs4all.nl/algol68g.pdf Algol 68G Manual - By Marcel van der Veer]
* [http://www.poenikatu.co.uk/algol68/ Programming Algol 68 Made Easy - Sian Mountbatten]
Or - if you prefer a hardcopy - you can try and pick up a hard cover manual like "''Informal Introduction to Algol 68''" - by C. H. Lindsey & S. V. Vander Meulen. Be sure to get the 1977 edition:
* [http://www.amazon.com/gp/offer-listing/0720405041/ref=dp_olp_used?ie=UTF8&condition=used www.amazon.com] - Aboout $119
* [http://search.barnesandnoble.com/Informal-Introduction-to-ALGOL-68/C-H-Lindsey/e/9780720407266/?itm=3&USRI=Informal+Introduction+to+Algol+68 barnesandnoble.com] - about $40
IItA68 is a beautiful book, and makes great "bedtime" reading... Highly recommended!
+* '''NEW:''' [http://www.softwarepreservation.org/projects/ALGOL/book/Lindsey_van_der_Meulen-IItA68-Revised.pdf softwarepreservation.org has an on-line IItA68 PDF] ready for download.
Editor modes:
* [http://www.jemarch.net/a68-mode Emacs mode] for Algol 68 supporting syntax highlighting and context-sensitive indentation.
-* [http://www.vim.org/scripts/script.php?script_id=1927 Vim script] providing support for syntax colouring.
+* [http://www.vim.org/scripts/script.php?script_id=1927 Vim script] providing support for syntax highlighting.
+* '''NEW:''' [http://qbnz.com/highlighter/demo.php GeSHi syntax highlighting]
==Status==
* 20th December 1968 - '''ALGOL 68's''' Final Report was ratified by [http://en.wikipedia.org/wiki/UNESCO UNESCO's] [http://en.wikipedia.org/wiki/IFIP IFIP] working group 2.1 in Munich.
diff --git a/Lang/ALGOL-68/Self-describing-numbers b/Lang/ALGOL-68/Self-describing-numbers
new file mode 120000
index 0000000000..00f78a7986
--- /dev/null
+++ b/Lang/ALGOL-68/Self-describing-numbers
@@ -0,0 +1 @@
+../../Task/Self-describing-numbers/ALGOL-68
\ No newline at end of file
diff --git a/Lang/Ada/Terminal-control-Inverse-video b/Lang/Ada/Terminal-control-Inverse-video
new file mode 120000
index 0000000000..27040276cd
--- /dev/null
+++ b/Lang/Ada/Terminal-control-Inverse-video
@@ -0,0 +1 @@
+../../Task/Terminal-control-Inverse-video/Ada
\ No newline at end of file
diff --git a/Lang/AppleScript/99-Bottles-of-Beer b/Lang/AppleScript/99-Bottles-of-Beer
new file mode 120000
index 0000000000..732d2d0298
--- /dev/null
+++ b/Lang/AppleScript/99-Bottles-of-Beer
@@ -0,0 +1 @@
+../../Task/99-Bottles-of-Beer/AppleScript
\ No newline at end of file
diff --git a/Lang/AppleScript/Execute-Brain---- b/Lang/AppleScript/Execute-Brain----
new file mode 120000
index 0000000000..427d66782d
--- /dev/null
+++ b/Lang/AppleScript/Execute-Brain----
@@ -0,0 +1 @@
+../../Task/Execute-Brain----/AppleScript
\ No newline at end of file
diff --git a/Lang/Applesoft-BASIC/Digital-root b/Lang/Applesoft-BASIC/Digital-root
new file mode 120000
index 0000000000..4c68db4997
--- /dev/null
+++ b/Lang/Applesoft-BASIC/Digital-root
@@ -0,0 +1 @@
+../../Task/Digital-root/Applesoft-BASIC
\ No newline at end of file
diff --git a/Lang/Applesoft-BASIC/Function-composition b/Lang/Applesoft-BASIC/Function-composition
new file mode 120000
index 0000000000..49f8637b23
--- /dev/null
+++ b/Lang/Applesoft-BASIC/Function-composition
@@ -0,0 +1 @@
+../../Task/Function-composition/Applesoft-BASIC
\ No newline at end of file
diff --git a/Lang/Applesoft-BASIC/Named-parameters b/Lang/Applesoft-BASIC/Named-parameters
new file mode 120000
index 0000000000..93ef811ac3
--- /dev/null
+++ b/Lang/Applesoft-BASIC/Named-parameters
@@ -0,0 +1 @@
+../../Task/Named-parameters/Applesoft-BASIC
\ No newline at end of file
diff --git a/Lang/Applesoft-BASIC/Variadic-function b/Lang/Applesoft-BASIC/Variadic-function
new file mode 120000
index 0000000000..8eddce00ea
--- /dev/null
+++ b/Lang/Applesoft-BASIC/Variadic-function
@@ -0,0 +1 @@
+../../Task/Variadic-function/Applesoft-BASIC
\ No newline at end of file
diff --git a/Lang/AutoHotkey/00DESCRIPTION b/Lang/AutoHotkey/00DESCRIPTION
index 3c6c3eb60d..1651708ee5 100644
--- a/Lang/AutoHotkey/00DESCRIPTION
+++ b/Lang/AutoHotkey/00DESCRIPTION
@@ -3,13 +3,14 @@
|parampass=both
|untyped=yes
|tags=ahk, autohotkey
-|site=http://www.autohotkey.com/
+|site=http://ahkscript.org/
|LCT=yes}}'''[[wp:AutoHotkey|AutoHotkey]]''' is an [[open source]] programming language for Microsoft [[Windows]].
==Citations==
-* [http://autohotkey.com/docs Documentation]
-* [http://autohotkey.net/ AutoHotkey.net] - user projects and [http://www.autohotkey.net/#archives archives]
-* [http://www.autohotkey.com/docs/scripts/ Script Showcase], [http://www.autohotkey.com/wiki/index.php?title=Script_Listing scripts: wiki]
-* [http://www.autohotkey.com/forum/ Community forum]
+* [http://ahkscript.org/docs Documentation]
+* [http://ahkscript.org/archives/Download.html Download archives]
+* [http://ahkscript.org/docs/scripts/ Script Showcase]
+* [http://ahkscript.org/wiki AutoHotkey Wiki]
+* [http://ahkscript.org/boards/ New Community forum], [http://www.autohotkey.com/forum/ Community forum]
* [[wp:AutoHotkey|AutoHotkey on Wikipedia]]
* [irc://irc.freenode.net/ahk #ahk] on [[Help:IRC|freenode]] ([http://webchat.freenode.net/?channels=%23ahk Web interface])
* [[:Category:AutoHotkey_Originated]]
\ No newline at end of file
diff --git a/Lang/AutoHotkey/Anagrams-Deranged-anagrams b/Lang/AutoHotkey/Anagrams-Deranged-anagrams
new file mode 120000
index 0000000000..d4931a66dd
--- /dev/null
+++ b/Lang/AutoHotkey/Anagrams-Deranged-anagrams
@@ -0,0 +1 @@
+../../Task/Anagrams-Deranged-anagrams/AutoHotkey
\ No newline at end of file
diff --git a/Lang/AutoHotkey/Animate-a-pendulum b/Lang/AutoHotkey/Animate-a-pendulum
new file mode 120000
index 0000000000..a0d4a8fea4
--- /dev/null
+++ b/Lang/AutoHotkey/Animate-a-pendulum
@@ -0,0 +1 @@
+../../Task/Animate-a-pendulum/AutoHotkey
\ No newline at end of file
diff --git a/Lang/AutoHotkey/Atomic-updates b/Lang/AutoHotkey/Atomic-updates
new file mode 120000
index 0000000000..b644569d66
--- /dev/null
+++ b/Lang/AutoHotkey/Atomic-updates
@@ -0,0 +1 @@
+../../Task/Atomic-updates/AutoHotkey
\ No newline at end of file
diff --git a/Lang/AutoHotkey/Averages-Mean-angle b/Lang/AutoHotkey/Averages-Mean-angle
new file mode 120000
index 0000000000..c08c5322a0
--- /dev/null
+++ b/Lang/AutoHotkey/Averages-Mean-angle
@@ -0,0 +1 @@
+../../Task/Averages-Mean-angle/AutoHotkey
\ No newline at end of file
diff --git a/Lang/AutoHotkey/Averages-Mean-time-of-day b/Lang/AutoHotkey/Averages-Mean-time-of-day
new file mode 120000
index 0000000000..8633b2d616
--- /dev/null
+++ b/Lang/AutoHotkey/Averages-Mean-time-of-day
@@ -0,0 +1 @@
+../../Task/Averages-Mean-time-of-day/AutoHotkey
\ No newline at end of file
diff --git a/Lang/AutoHotkey/Balanced-ternary b/Lang/AutoHotkey/Balanced-ternary
new file mode 120000
index 0000000000..99f3fa9be0
--- /dev/null
+++ b/Lang/AutoHotkey/Balanced-ternary
@@ -0,0 +1 @@
+../../Task/Balanced-ternary/AutoHotkey
\ No newline at end of file
diff --git a/Lang/AutoHotkey/Bitwise-IO b/Lang/AutoHotkey/Bitwise-IO
new file mode 120000
index 0000000000..ba731c224c
--- /dev/null
+++ b/Lang/AutoHotkey/Bitwise-IO
@@ -0,0 +1 @@
+../../Task/Bitwise-IO/AutoHotkey
\ No newline at end of file
diff --git a/Lang/AutoHotkey/Bulls-and-cows-Player b/Lang/AutoHotkey/Bulls-and-cows-Player
new file mode 120000
index 0000000000..00d5ccc67d
--- /dev/null
+++ b/Lang/AutoHotkey/Bulls-and-cows-Player
@@ -0,0 +1 @@
+../../Task/Bulls-and-cows-Player/AutoHotkey
\ No newline at end of file
diff --git a/Lang/AutoHotkey/CRC-32 b/Lang/AutoHotkey/CRC-32
new file mode 120000
index 0000000000..7c43bf797f
--- /dev/null
+++ b/Lang/AutoHotkey/CRC-32
@@ -0,0 +1 @@
+../../Task/CRC-32/AutoHotkey
\ No newline at end of file
diff --git a/Lang/AutoHotkey/Calendar b/Lang/AutoHotkey/Calendar
new file mode 120000
index 0000000000..d335097643
--- /dev/null
+++ b/Lang/AutoHotkey/Calendar
@@ -0,0 +1 @@
+../../Task/Calendar/AutoHotkey
\ No newline at end of file
diff --git a/Lang/AutoHotkey/Calendar---for-real-programmers b/Lang/AutoHotkey/Calendar---for-real-programmers
new file mode 120000
index 0000000000..f36b0f14e6
--- /dev/null
+++ b/Lang/AutoHotkey/Calendar---for-real-programmers
@@ -0,0 +1 @@
+../../Task/Calendar---for-real-programmers/AutoHotkey
\ No newline at end of file
diff --git a/Lang/AutoHotkey/DNS-query b/Lang/AutoHotkey/DNS-query
new file mode 120000
index 0000000000..6252362d7e
--- /dev/null
+++ b/Lang/AutoHotkey/DNS-query
@@ -0,0 +1 @@
+../../Task/DNS-query/AutoHotkey
\ No newline at end of file
diff --git a/Lang/AutoHotkey/Deal-cards-for-FreeCell b/Lang/AutoHotkey/Deal-cards-for-FreeCell
new file mode 120000
index 0000000000..7b338e0b50
--- /dev/null
+++ b/Lang/AutoHotkey/Deal-cards-for-FreeCell
@@ -0,0 +1 @@
+../../Task/Deal-cards-for-FreeCell/AutoHotkey
\ No newline at end of file
diff --git a/Lang/AutoHotkey/Death-Star b/Lang/AutoHotkey/Death-Star
new file mode 120000
index 0000000000..de5a3e91ea
--- /dev/null
+++ b/Lang/AutoHotkey/Death-Star
@@ -0,0 +1 @@
+../../Task/Death-Star/AutoHotkey
\ No newline at end of file
diff --git a/Lang/AutoHotkey/Deepcopy b/Lang/AutoHotkey/Deepcopy
new file mode 120000
index 0000000000..5bb284fa23
--- /dev/null
+++ b/Lang/AutoHotkey/Deepcopy
@@ -0,0 +1 @@
+../../Task/Deepcopy/AutoHotkey
\ No newline at end of file
diff --git a/Lang/AutoHotkey/Digital-root b/Lang/AutoHotkey/Digital-root
new file mode 120000
index 0000000000..b4410e7fd9
--- /dev/null
+++ b/Lang/AutoHotkey/Digital-root
@@ -0,0 +1 @@
+../../Task/Digital-root/AutoHotkey
\ No newline at end of file
diff --git a/Lang/AutoHotkey/Dining-philosophers b/Lang/AutoHotkey/Dining-philosophers
new file mode 120000
index 0000000000..c888e730c0
--- /dev/null
+++ b/Lang/AutoHotkey/Dining-philosophers
@@ -0,0 +1 @@
+../../Task/Dining-philosophers/AutoHotkey
\ No newline at end of file
diff --git a/Lang/AutoHotkey/Draw-a-cuboid b/Lang/AutoHotkey/Draw-a-cuboid
new file mode 120000
index 0000000000..f8c9084dec
--- /dev/null
+++ b/Lang/AutoHotkey/Draw-a-cuboid
@@ -0,0 +1 @@
+../../Task/Draw-a-cuboid/AutoHotkey
\ No newline at end of file
diff --git a/Lang/AutoHotkey/Draw-a-sphere b/Lang/AutoHotkey/Draw-a-sphere
new file mode 120000
index 0000000000..41e61c43b8
--- /dev/null
+++ b/Lang/AutoHotkey/Draw-a-sphere
@@ -0,0 +1 @@
+../../Task/Draw-a-sphere/AutoHotkey
\ No newline at end of file
diff --git a/Lang/AutoHotkey/Dutch-national-flag-problem b/Lang/AutoHotkey/Dutch-national-flag-problem
new file mode 120000
index 0000000000..1b5db78797
--- /dev/null
+++ b/Lang/AutoHotkey/Dutch-national-flag-problem
@@ -0,0 +1 @@
+../../Task/Dutch-national-flag-problem/AutoHotkey
\ No newline at end of file
diff --git a/Lang/AutoHotkey/Empty-directory b/Lang/AutoHotkey/Empty-directory
new file mode 120000
index 0000000000..4e550697fe
--- /dev/null
+++ b/Lang/AutoHotkey/Empty-directory
@@ -0,0 +1 @@
+../../Task/Empty-directory/AutoHotkey
\ No newline at end of file
diff --git a/Lang/AutoHotkey/Entropy b/Lang/AutoHotkey/Entropy
new file mode 120000
index 0000000000..0bbce32d90
--- /dev/null
+++ b/Lang/AutoHotkey/Entropy
@@ -0,0 +1 @@
+../../Task/Entropy/AutoHotkey
\ No newline at end of file
diff --git a/Lang/AutoHotkey/Equilibrium-index b/Lang/AutoHotkey/Equilibrium-index
new file mode 120000
index 0000000000..a972e67616
--- /dev/null
+++ b/Lang/AutoHotkey/Equilibrium-index
@@ -0,0 +1 @@
+../../Task/Equilibrium-index/AutoHotkey
\ No newline at end of file
diff --git a/Lang/AutoHotkey/Fibonacci-n-step-number-sequences b/Lang/AutoHotkey/Fibonacci-n-step-number-sequences
new file mode 120000
index 0000000000..48e467af25
--- /dev/null
+++ b/Lang/AutoHotkey/Fibonacci-n-step-number-sequences
@@ -0,0 +1 @@
+../../Task/Fibonacci-n-step-number-sequences/AutoHotkey
\ No newline at end of file
diff --git a/Lang/AutoHotkey/Floyds-triangle b/Lang/AutoHotkey/Floyds-triangle
new file mode 120000
index 0000000000..12332f0efd
--- /dev/null
+++ b/Lang/AutoHotkey/Floyds-triangle
@@ -0,0 +1 @@
+../../Task/Floyds-triangle/AutoHotkey
\ No newline at end of file
diff --git a/Lang/AutoHotkey/Four-bit-adder b/Lang/AutoHotkey/Four-bit-adder
new file mode 120000
index 0000000000..55e8d511d3
--- /dev/null
+++ b/Lang/AutoHotkey/Four-bit-adder
@@ -0,0 +1 @@
+../../Task/Four-bit-adder/AutoHotkey
\ No newline at end of file
diff --git a/Lang/AutoHotkey/Fractal-tree b/Lang/AutoHotkey/Fractal-tree
new file mode 120000
index 0000000000..20cb484cf2
--- /dev/null
+++ b/Lang/AutoHotkey/Fractal-tree
@@ -0,0 +1 @@
+../../Task/Fractal-tree/AutoHotkey
\ No newline at end of file
diff --git a/Lang/AutoHotkey/GUI-Maximum-window-dimensions b/Lang/AutoHotkey/GUI-Maximum-window-dimensions
new file mode 120000
index 0000000000..c153ec1669
--- /dev/null
+++ b/Lang/AutoHotkey/GUI-Maximum-window-dimensions
@@ -0,0 +1 @@
+../../Task/GUI-Maximum-window-dimensions/AutoHotkey
\ No newline at end of file
diff --git a/Lang/AutoHotkey/Handle-a-signal b/Lang/AutoHotkey/Handle-a-signal
new file mode 120000
index 0000000000..58b9bffc66
--- /dev/null
+++ b/Lang/AutoHotkey/Handle-a-signal
@@ -0,0 +1 @@
+../../Task/Handle-a-signal/AutoHotkey
\ No newline at end of file
diff --git a/Lang/AutoHotkey/Harshad-or-Niven-series b/Lang/AutoHotkey/Harshad-or-Niven-series
new file mode 120000
index 0000000000..4ebe07e7ab
--- /dev/null
+++ b/Lang/AutoHotkey/Harshad-or-Niven-series
@@ -0,0 +1 @@
+../../Task/Harshad-or-Niven-series/AutoHotkey
\ No newline at end of file
diff --git a/Lang/AutoHotkey/Haversine-formula b/Lang/AutoHotkey/Haversine-formula
new file mode 120000
index 0000000000..4e2c97ff2c
--- /dev/null
+++ b/Lang/AutoHotkey/Haversine-formula
@@ -0,0 +1 @@
+../../Task/Haversine-formula/AutoHotkey
\ No newline at end of file
diff --git a/Lang/AutoHotkey/History-variables b/Lang/AutoHotkey/History-variables
new file mode 120000
index 0000000000..1e24011320
--- /dev/null
+++ b/Lang/AutoHotkey/History-variables
@@ -0,0 +1 @@
+../../Task/History-variables/AutoHotkey
\ No newline at end of file
diff --git a/Lang/AutoHotkey/Hofstadter-Figure-Figure-sequences b/Lang/AutoHotkey/Hofstadter-Figure-Figure-sequences
new file mode 120000
index 0000000000..0d67386dc0
--- /dev/null
+++ b/Lang/AutoHotkey/Hofstadter-Figure-Figure-sequences
@@ -0,0 +1 @@
+../../Task/Hofstadter-Figure-Figure-sequences/AutoHotkey
\ No newline at end of file
diff --git a/Lang/AutoHotkey/Hofstadter-Q-sequence b/Lang/AutoHotkey/Hofstadter-Q-sequence
new file mode 120000
index 0000000000..6e35e3b02a
--- /dev/null
+++ b/Lang/AutoHotkey/Hofstadter-Q-sequence
@@ -0,0 +1 @@
+../../Task/Hofstadter-Q-sequence/AutoHotkey
\ No newline at end of file
diff --git a/Lang/AutoHotkey/Identity-matrix b/Lang/AutoHotkey/Identity-matrix
new file mode 120000
index 0000000000..21b4179865
--- /dev/null
+++ b/Lang/AutoHotkey/Identity-matrix
@@ -0,0 +1 @@
+../../Task/Identity-matrix/AutoHotkey
\ No newline at end of file
diff --git a/Lang/AutoHotkey/Joystick-position b/Lang/AutoHotkey/Joystick-position
new file mode 120000
index 0000000000..784f4718d4
--- /dev/null
+++ b/Lang/AutoHotkey/Joystick-position
@@ -0,0 +1 @@
+../../Task/Joystick-position/AutoHotkey
\ No newline at end of file
diff --git a/Lang/AutoHotkey/Kaprekar-numbers b/Lang/AutoHotkey/Kaprekar-numbers
new file mode 120000
index 0000000000..8b9e46a9ba
--- /dev/null
+++ b/Lang/AutoHotkey/Kaprekar-numbers
@@ -0,0 +1 @@
+../../Task/Kaprekar-numbers/AutoHotkey
\ No newline at end of file
diff --git a/Lang/AutoHotkey/Keyboard-input-Keypress-check b/Lang/AutoHotkey/Keyboard-input-Keypress-check
new file mode 120000
index 0000000000..ced00e3b90
--- /dev/null
+++ b/Lang/AutoHotkey/Keyboard-input-Keypress-check
@@ -0,0 +1 @@
+../../Task/Keyboard-input-Keypress-check/AutoHotkey
\ No newline at end of file
diff --git a/Lang/AutoHotkey/Knights-tour b/Lang/AutoHotkey/Knights-tour
new file mode 120000
index 0000000000..8f772a5db9
--- /dev/null
+++ b/Lang/AutoHotkey/Knights-tour
@@ -0,0 +1 @@
+../../Task/Knights-tour/AutoHotkey
\ No newline at end of file
diff --git a/Lang/AutoHotkey/Largest-int-from-concatenated-ints b/Lang/AutoHotkey/Largest-int-from-concatenated-ints
new file mode 120000
index 0000000000..0c7ecedfeb
--- /dev/null
+++ b/Lang/AutoHotkey/Largest-int-from-concatenated-ints
@@ -0,0 +1 @@
+../../Task/Largest-int-from-concatenated-ints/AutoHotkey
\ No newline at end of file
diff --git a/Lang/AutoHotkey/Linear-congruential-generator b/Lang/AutoHotkey/Linear-congruential-generator
new file mode 120000
index 0000000000..3bdd8d19b4
--- /dev/null
+++ b/Lang/AutoHotkey/Linear-congruential-generator
@@ -0,0 +1 @@
+../../Task/Linear-congruential-generator/AutoHotkey
\ No newline at end of file
diff --git a/Lang/AutoHotkey/Minesweeper-game b/Lang/AutoHotkey/Minesweeper-game
new file mode 120000
index 0000000000..7bbb551701
--- /dev/null
+++ b/Lang/AutoHotkey/Minesweeper-game
@@ -0,0 +1 @@
+../../Task/Minesweeper-game/AutoHotkey
\ No newline at end of file
diff --git a/Lang/AutoHotkey/Modular-exponentiation b/Lang/AutoHotkey/Modular-exponentiation
new file mode 120000
index 0000000000..32bd11119e
--- /dev/null
+++ b/Lang/AutoHotkey/Modular-exponentiation
@@ -0,0 +1 @@
+../../Task/Modular-exponentiation/AutoHotkey
\ No newline at end of file
diff --git a/Lang/AutoHotkey/Modular-inverse b/Lang/AutoHotkey/Modular-inverse
new file mode 120000
index 0000000000..8261163e50
--- /dev/null
+++ b/Lang/AutoHotkey/Modular-inverse
@@ -0,0 +1 @@
+../../Task/Modular-inverse/AutoHotkey
\ No newline at end of file
diff --git a/Lang/AutoHotkey/Multifactorial b/Lang/AutoHotkey/Multifactorial
new file mode 120000
index 0000000000..22f7d9a8c9
--- /dev/null
+++ b/Lang/AutoHotkey/Multifactorial
@@ -0,0 +1 @@
+../../Task/Multifactorial/AutoHotkey
\ No newline at end of file
diff --git a/Lang/AutoHotkey/Multisplit b/Lang/AutoHotkey/Multisplit
new file mode 120000
index 0000000000..ccca8b215f
--- /dev/null
+++ b/Lang/AutoHotkey/Multisplit
@@ -0,0 +1 @@
+../../Task/Multisplit/AutoHotkey
\ No newline at end of file
diff --git a/Lang/AutoHotkey/Pi b/Lang/AutoHotkey/Pi
new file mode 120000
index 0000000000..545946d060
--- /dev/null
+++ b/Lang/AutoHotkey/Pi
@@ -0,0 +1 @@
+../../Task/Pi/AutoHotkey
\ No newline at end of file
diff --git a/Lang/AutoHotkey/Pig-the-dice-game b/Lang/AutoHotkey/Pig-the-dice-game
new file mode 120000
index 0000000000..8f54b20903
--- /dev/null
+++ b/Lang/AutoHotkey/Pig-the-dice-game
@@ -0,0 +1 @@
+../../Task/Pig-the-dice-game/AutoHotkey
\ No newline at end of file
diff --git a/Lang/AutoHotkey/Pig-the-dice-game-Player b/Lang/AutoHotkey/Pig-the-dice-game-Player
new file mode 120000
index 0000000000..e36f93a44f
--- /dev/null
+++ b/Lang/AutoHotkey/Pig-the-dice-game-Player
@@ -0,0 +1 @@
+../../Task/Pig-the-dice-game-Player/AutoHotkey
\ No newline at end of file
diff --git a/Lang/AutoHotkey/Plot-coordinate-pairs b/Lang/AutoHotkey/Plot-coordinate-pairs
new file mode 120000
index 0000000000..0a02a351e2
--- /dev/null
+++ b/Lang/AutoHotkey/Plot-coordinate-pairs
@@ -0,0 +1 @@
+../../Task/Plot-coordinate-pairs/AutoHotkey
\ No newline at end of file
diff --git a/Lang/AutoHotkey/Priority-queue b/Lang/AutoHotkey/Priority-queue
new file mode 120000
index 0000000000..fdc421d3dd
--- /dev/null
+++ b/Lang/AutoHotkey/Priority-queue
@@ -0,0 +1 @@
+../../Task/Priority-queue/AutoHotkey
\ No newline at end of file
diff --git a/Lang/AutoHotkey/Problem-of-Apollonius b/Lang/AutoHotkey/Problem-of-Apollonius
new file mode 120000
index 0000000000..704dfd38b2
--- /dev/null
+++ b/Lang/AutoHotkey/Problem-of-Apollonius
@@ -0,0 +1 @@
+../../Task/Problem-of-Apollonius/AutoHotkey
\ No newline at end of file
diff --git a/Lang/AutoHotkey/Pythagorean-triples b/Lang/AutoHotkey/Pythagorean-triples
new file mode 120000
index 0000000000..228f597111
--- /dev/null
+++ b/Lang/AutoHotkey/Pythagorean-triples
@@ -0,0 +1 @@
+../../Task/Pythagorean-triples/AutoHotkey
\ No newline at end of file
diff --git a/Lang/AutoHotkey/Quaternion-type b/Lang/AutoHotkey/Quaternion-type
new file mode 120000
index 0000000000..00a1a5a068
--- /dev/null
+++ b/Lang/AutoHotkey/Quaternion-type
@@ -0,0 +1 @@
+../../Task/Quaternion-type/AutoHotkey
\ No newline at end of file
diff --git a/Lang/AutoHotkey/Rate-counter b/Lang/AutoHotkey/Rate-counter
new file mode 120000
index 0000000000..843eb4d580
--- /dev/null
+++ b/Lang/AutoHotkey/Rate-counter
@@ -0,0 +1 @@
+../../Task/Rate-counter/AutoHotkey
\ No newline at end of file
diff --git a/Lang/AutoHotkey/Record-sound b/Lang/AutoHotkey/Record-sound
new file mode 120000
index 0000000000..907acfd4f1
--- /dev/null
+++ b/Lang/AutoHotkey/Record-sound
@@ -0,0 +1 @@
+../../Task/Record-sound/AutoHotkey
\ No newline at end of file
diff --git a/Lang/AutoHotkey/Respond-to-an-unknown-method-call b/Lang/AutoHotkey/Respond-to-an-unknown-method-call
new file mode 120000
index 0000000000..b34a5aa3ed
--- /dev/null
+++ b/Lang/AutoHotkey/Respond-to-an-unknown-method-call
@@ -0,0 +1 @@
+../../Task/Respond-to-an-unknown-method-call/AutoHotkey
\ No newline at end of file
diff --git a/Lang/AutoHotkey/S-Expressions b/Lang/AutoHotkey/S-Expressions
new file mode 120000
index 0000000000..ccb024b3b2
--- /dev/null
+++ b/Lang/AutoHotkey/S-Expressions
@@ -0,0 +1 @@
+../../Task/S-Expressions/AutoHotkey
\ No newline at end of file
diff --git a/Lang/AutoHotkey/Safe-addition b/Lang/AutoHotkey/Safe-addition
new file mode 120000
index 0000000000..8bc6de7f02
--- /dev/null
+++ b/Lang/AutoHotkey/Safe-addition
@@ -0,0 +1 @@
+../../Task/Safe-addition/AutoHotkey
\ No newline at end of file
diff --git a/Lang/AutoHotkey/Semordnilap b/Lang/AutoHotkey/Semordnilap
new file mode 120000
index 0000000000..673958d128
--- /dev/null
+++ b/Lang/AutoHotkey/Semordnilap
@@ -0,0 +1 @@
+../../Task/Semordnilap/AutoHotkey
\ No newline at end of file
diff --git a/Lang/AutoHotkey/Set b/Lang/AutoHotkey/Set
new file mode 120000
index 0000000000..aaab63e893
--- /dev/null
+++ b/Lang/AutoHotkey/Set
@@ -0,0 +1 @@
+../../Task/Set/AutoHotkey
\ No newline at end of file
diff --git a/Lang/AutoHotkey/Set-puzzle b/Lang/AutoHotkey/Set-puzzle
new file mode 120000
index 0000000000..2fc19747b3
--- /dev/null
+++ b/Lang/AutoHotkey/Set-puzzle
@@ -0,0 +1 @@
+../../Task/Set-puzzle/AutoHotkey
\ No newline at end of file
diff --git a/Lang/AutoHotkey/Sierpinski-triangle-Graphical b/Lang/AutoHotkey/Sierpinski-triangle-Graphical
new file mode 120000
index 0000000000..87565fc05a
--- /dev/null
+++ b/Lang/AutoHotkey/Sierpinski-triangle-Graphical
@@ -0,0 +1 @@
+../../Task/Sierpinski-triangle-Graphical/AutoHotkey
\ No newline at end of file
diff --git a/Lang/AutoHotkey/Sorting-algorithms-Bead-sort b/Lang/AutoHotkey/Sorting-algorithms-Bead-sort
new file mode 120000
index 0000000000..35f802268b
--- /dev/null
+++ b/Lang/AutoHotkey/Sorting-algorithms-Bead-sort
@@ -0,0 +1 @@
+../../Task/Sorting-algorithms-Bead-sort/AutoHotkey
\ No newline at end of file
diff --git a/Lang/AutoHotkey/Sorting-algorithms-Radix-sort b/Lang/AutoHotkey/Sorting-algorithms-Radix-sort
new file mode 120000
index 0000000000..d999a70155
--- /dev/null
+++ b/Lang/AutoHotkey/Sorting-algorithms-Radix-sort
@@ -0,0 +1 @@
+../../Task/Sorting-algorithms-Radix-sort/AutoHotkey
\ No newline at end of file
diff --git a/Lang/AutoHotkey/Sorting-algorithms-Strand-sort b/Lang/AutoHotkey/Sorting-algorithms-Strand-sort
new file mode 120000
index 0000000000..5812d12875
--- /dev/null
+++ b/Lang/AutoHotkey/Sorting-algorithms-Strand-sort
@@ -0,0 +1 @@
+../../Task/Sorting-algorithms-Strand-sort/AutoHotkey
\ No newline at end of file
diff --git a/Lang/AutoHotkey/Stable-marriage-problem b/Lang/AutoHotkey/Stable-marriage-problem
new file mode 120000
index 0000000000..7b7c4e039e
--- /dev/null
+++ b/Lang/AutoHotkey/Stable-marriage-problem
@@ -0,0 +1 @@
+../../Task/Stable-marriage-problem/AutoHotkey
\ No newline at end of file
diff --git a/Lang/AutoHotkey/Subtractive-generator b/Lang/AutoHotkey/Subtractive-generator
new file mode 120000
index 0000000000..3c3eaefd7e
--- /dev/null
+++ b/Lang/AutoHotkey/Subtractive-generator
@@ -0,0 +1 @@
+../../Task/Subtractive-generator/AutoHotkey
\ No newline at end of file
diff --git a/Lang/AutoHotkey/Ternary-logic b/Lang/AutoHotkey/Ternary-logic
new file mode 120000
index 0000000000..8e1df0f407
--- /dev/null
+++ b/Lang/AutoHotkey/Ternary-logic
@@ -0,0 +1 @@
+../../Task/Ternary-logic/AutoHotkey
\ No newline at end of file
diff --git a/Lang/AutoHotkey/Topswops b/Lang/AutoHotkey/Topswops
new file mode 120000
index 0000000000..2c8f345fc7
--- /dev/null
+++ b/Lang/AutoHotkey/Topswops
@@ -0,0 +1 @@
+../../Task/Topswops/AutoHotkey
\ No newline at end of file
diff --git a/Lang/AutoHotkey/Truncatable-primes b/Lang/AutoHotkey/Truncatable-primes
new file mode 120000
index 0000000000..af117a5671
--- /dev/null
+++ b/Lang/AutoHotkey/Truncatable-primes
@@ -0,0 +1 @@
+../../Task/Truncatable-primes/AutoHotkey
\ No newline at end of file
diff --git a/Lang/AutoHotkey/Truncate-a-file b/Lang/AutoHotkey/Truncate-a-file
new file mode 120000
index 0000000000..4ea3f1f532
--- /dev/null
+++ b/Lang/AutoHotkey/Truncate-a-file
@@ -0,0 +1 @@
+../../Task/Truncate-a-file/AutoHotkey
\ No newline at end of file
diff --git a/Lang/AutoHotkey/Twelve-statements b/Lang/AutoHotkey/Twelve-statements
new file mode 120000
index 0000000000..8028a03e0e
--- /dev/null
+++ b/Lang/AutoHotkey/Twelve-statements
@@ -0,0 +1 @@
+../../Task/Twelve-statements/AutoHotkey
\ No newline at end of file
diff --git a/Lang/AutoHotkey/Universal-Turing-machine b/Lang/AutoHotkey/Universal-Turing-machine
new file mode 120000
index 0000000000..7165d9d482
--- /dev/null
+++ b/Lang/AutoHotkey/Universal-Turing-machine
@@ -0,0 +1 @@
+../../Task/Universal-Turing-machine/AutoHotkey
\ No newline at end of file
diff --git a/Lang/AutoHotkey/Vampire-number b/Lang/AutoHotkey/Vampire-number
new file mode 120000
index 0000000000..ebd9bc1f5f
--- /dev/null
+++ b/Lang/AutoHotkey/Vampire-number
@@ -0,0 +1 @@
+../../Task/Vampire-number/AutoHotkey
\ No newline at end of file
diff --git a/Lang/AutoHotkey/Van-der-Corput-sequence b/Lang/AutoHotkey/Van-der-Corput-sequence
new file mode 120000
index 0000000000..16a0332f33
--- /dev/null
+++ b/Lang/AutoHotkey/Van-der-Corput-sequence
@@ -0,0 +1 @@
+../../Task/Van-der-Corput-sequence/AutoHotkey
\ No newline at end of file
diff --git a/Lang/AutoHotkey/Vector-products b/Lang/AutoHotkey/Vector-products
new file mode 120000
index 0000000000..4be128b633
--- /dev/null
+++ b/Lang/AutoHotkey/Vector-products
@@ -0,0 +1 @@
+../../Task/Vector-products/AutoHotkey
\ No newline at end of file
diff --git a/Lang/AutoHotkey/Wireworld b/Lang/AutoHotkey/Wireworld
new file mode 120000
index 0000000000..41ebbb9395
--- /dev/null
+++ b/Lang/AutoHotkey/Wireworld
@@ -0,0 +1 @@
+../../Task/Wireworld/AutoHotkey
\ No newline at end of file
diff --git a/Lang/AutoHotkey/Write-to-Windows-event-log b/Lang/AutoHotkey/Write-to-Windows-event-log
new file mode 120000
index 0000000000..c1697131df
--- /dev/null
+++ b/Lang/AutoHotkey/Write-to-Windows-event-log
@@ -0,0 +1 @@
+../../Task/Write-to-Windows-event-log/AutoHotkey
\ No newline at end of file
diff --git a/Lang/AutoHotkey/Zeckendorf-number-representation b/Lang/AutoHotkey/Zeckendorf-number-representation
new file mode 120000
index 0000000000..614176c764
--- /dev/null
+++ b/Lang/AutoHotkey/Zeckendorf-number-representation
@@ -0,0 +1 @@
+../../Task/Zeckendorf-number-representation/AutoHotkey
\ No newline at end of file
diff --git a/Lang/AutoIt/Loops-N-plus-one-half b/Lang/AutoIt/Loops-N-plus-one-half
new file mode 120000
index 0000000000..a254611d04
--- /dev/null
+++ b/Lang/AutoIt/Loops-N-plus-one-half
@@ -0,0 +1 @@
+../../Task/Loops-N-plus-one-half/AutoIt
\ No newline at end of file
diff --git a/Lang/AutoIt/Primality-by-trial-division b/Lang/AutoIt/Primality-by-trial-division
new file mode 120000
index 0000000000..fa5158a37e
--- /dev/null
+++ b/Lang/AutoIt/Primality-by-trial-division
@@ -0,0 +1 @@
+../../Task/Primality-by-trial-division/AutoIt
\ No newline at end of file
diff --git a/Lang/Batch-File/Execute-a-system-command b/Lang/Batch-File/Execute-a-system-command
new file mode 120000
index 0000000000..970e2793c7
--- /dev/null
+++ b/Lang/Batch-File/Execute-a-system-command
@@ -0,0 +1 @@
+../../Task/Execute-a-system-command/Batch-File
\ No newline at end of file
diff --git a/Lang/Befunge/Exponentiation-operator b/Lang/Befunge/Exponentiation-operator
new file mode 120000
index 0000000000..14d552c6b9
--- /dev/null
+++ b/Lang/Befunge/Exponentiation-operator
@@ -0,0 +1 @@
+../../Task/Exponentiation-operator/Befunge
\ No newline at end of file
diff --git a/Lang/Bracmat/Call-an-object-method b/Lang/Bracmat/Call-an-object-method
new file mode 120000
index 0000000000..37efce211f
--- /dev/null
+++ b/Lang/Bracmat/Call-an-object-method
@@ -0,0 +1 @@
+../../Task/Call-an-object-method/Bracmat
\ No newline at end of file
diff --git a/Lang/Bracmat/Classes b/Lang/Bracmat/Classes
new file mode 120000
index 0000000000..19f8d36738
--- /dev/null
+++ b/Lang/Bracmat/Classes
@@ -0,0 +1 @@
+../../Task/Classes/Bracmat
\ No newline at end of file
diff --git a/Lang/Bracmat/Enforced-immutability b/Lang/Bracmat/Enforced-immutability
new file mode 120000
index 0000000000..9770f766f8
--- /dev/null
+++ b/Lang/Bracmat/Enforced-immutability
@@ -0,0 +1 @@
+../../Task/Enforced-immutability/Bracmat
\ No newline at end of file
diff --git a/Lang/Bracmat/Enumerations b/Lang/Bracmat/Enumerations
new file mode 120000
index 0000000000..a0ef25f328
--- /dev/null
+++ b/Lang/Bracmat/Enumerations
@@ -0,0 +1 @@
+../../Task/Enumerations/Bracmat
\ No newline at end of file
diff --git a/Lang/Bracmat/Hamming-numbers b/Lang/Bracmat/Hamming-numbers
new file mode 120000
index 0000000000..b7cae5c20a
--- /dev/null
+++ b/Lang/Bracmat/Hamming-numbers
@@ -0,0 +1 @@
+../../Task/Hamming-numbers/Bracmat
\ No newline at end of file
diff --git a/Lang/Bracmat/Logical-operations b/Lang/Bracmat/Logical-operations
new file mode 120000
index 0000000000..63c3bbc1bb
--- /dev/null
+++ b/Lang/Bracmat/Logical-operations
@@ -0,0 +1 @@
+../../Task/Logical-operations/Bracmat
\ No newline at end of file
diff --git a/Lang/Bracmat/Named-parameters b/Lang/Bracmat/Named-parameters
new file mode 120000
index 0000000000..44b443c7b1
--- /dev/null
+++ b/Lang/Bracmat/Named-parameters
@@ -0,0 +1 @@
+../../Task/Named-parameters/Bracmat
\ No newline at end of file
diff --git a/Lang/Bracmat/Scope-modifiers b/Lang/Bracmat/Scope-modifiers
new file mode 120000
index 0000000000..de9a21dcb7
--- /dev/null
+++ b/Lang/Bracmat/Scope-modifiers
@@ -0,0 +1 @@
+../../Task/Scope-modifiers/Bracmat
\ No newline at end of file
diff --git a/Lang/Bracmat/Sorting-algorithms-Quicksort b/Lang/Bracmat/Sorting-algorithms-Quicksort
new file mode 120000
index 0000000000..4621135075
--- /dev/null
+++ b/Lang/Bracmat/Sorting-algorithms-Quicksort
@@ -0,0 +1 @@
+../../Task/Sorting-algorithms-Quicksort/Bracmat
\ No newline at end of file
diff --git a/Lang/Bracmat/Strip-comments-from-a-string b/Lang/Bracmat/Strip-comments-from-a-string
new file mode 120000
index 0000000000..79e1b89bcd
--- /dev/null
+++ b/Lang/Bracmat/Strip-comments-from-a-string
@@ -0,0 +1 @@
+../../Task/Strip-comments-from-a-string/Bracmat
\ No newline at end of file
diff --git a/Lang/Bracmat/Strip-control-codes-and-extended-characters-from-a-string b/Lang/Bracmat/Strip-control-codes-and-extended-characters-from-a-string
new file mode 120000
index 0000000000..9576f0a690
--- /dev/null
+++ b/Lang/Bracmat/Strip-control-codes-and-extended-characters-from-a-string
@@ -0,0 +1 @@
+../../Task/Strip-control-codes-and-extended-characters-from-a-string/Bracmat
\ No newline at end of file
diff --git a/Lang/Bracmat/Terminal-control-Display-an-extended-character b/Lang/Bracmat/Terminal-control-Display-an-extended-character
new file mode 120000
index 0000000000..bc9c8b601b
--- /dev/null
+++ b/Lang/Bracmat/Terminal-control-Display-an-extended-character
@@ -0,0 +1 @@
+../../Task/Terminal-control-Display-an-extended-character/Bracmat
\ No newline at end of file
diff --git a/Lang/Bracmat/Truncate-a-file b/Lang/Bracmat/Truncate-a-file
new file mode 120000
index 0000000000..e4060660aa
--- /dev/null
+++ b/Lang/Bracmat/Truncate-a-file
@@ -0,0 +1 @@
+../../Task/Truncate-a-file/Bracmat
\ No newline at end of file
diff --git a/Lang/Brainf---/Sorting-algorithms-Sleep-sort b/Lang/Brainf---/Sorting-algorithms-Sleep-sort
new file mode 120000
index 0000000000..e7c8214dac
--- /dev/null
+++ b/Lang/Brainf---/Sorting-algorithms-Sleep-sort
@@ -0,0 +1 @@
+../../Task/Sorting-algorithms-Sleep-sort/Brainf---
\ No newline at end of file
diff --git a/Lang/Brat/Averages-Simple-moving-average b/Lang/Brat/Averages-Simple-moving-average
new file mode 120000
index 0000000000..9d96b0f7eb
--- /dev/null
+++ b/Lang/Brat/Averages-Simple-moving-average
@@ -0,0 +1 @@
+../../Task/Averages-Simple-moving-average/Brat
\ No newline at end of file
diff --git a/Lang/C++/00DESCRIPTION b/Lang/C++/00DESCRIPTION
index a40d989057..17ed7f4c2b 100644
--- a/Lang/C++/00DESCRIPTION
+++ b/Lang/C++/00DESCRIPTION
@@ -12,7 +12,7 @@
|LCT=yes
|bnf=http://cpp.comsci.us/syntax/statement/index.html}}{{codepad}}{{allows|Network access}}{{allows|Database access
}}{{allows|Concurrency}}{{provides|Run time polymorphism}}{{provides|Compile time polymorphism}}{{allows|Windowing UI}}{{allows|Graphics}}{{allows|OpenGL}}{{allows|Dynamic linking}}{{provides|File access}}{{allows|File system access}}{{provides|Objects}}{{allows|Signal handling}}{{provides|Mutable state}}
-'''C++''' is named after the [[derived from::compatible with::C]] language, from which it is derived. C++ extends C into becoming an [[object-oriented language]]. However, unlike other object-oriented languages, it doesn't try to force you into [[object-oriented programming]], but is a multi-[[:Category:Programming Paradigms|paradigm]] language. Besides conventional [[procedural programming]] and object-oriented programming, it also supports [[generic programming]].
+'''C++''' is named after the [[derived from::compatible with::C]] language, from which it is derived. C++ extends C into an [[object-oriented language]]. However, unlike other object-oriented languages, it doesn't try to force you into [[object-oriented programming]], but is a multi-[[:Category:Programming Paradigms|paradigm]] language. Besides conventional [[procedural programming]] and object-oriented programming, it also supports [[generic programming]].
The ++ in C++ is some what of an inside joke, in that C++ is C with a Post Increment operator attached, thus C++ is C + 1; however, this interpretation has the flaw that post-increment increments the value ''after'' returning the value, so the post-increment expression still evaluates to the value before the increment.
diff --git a/Lang/C++/Balanced-ternary b/Lang/C++/Balanced-ternary
new file mode 120000
index 0000000000..1fe4f888a0
--- /dev/null
+++ b/Lang/C++/Balanced-ternary
@@ -0,0 +1 @@
+../../Task/Balanced-ternary/C++
\ No newline at end of file
diff --git a/Lang/C-sharp/Pig-the-dice-game b/Lang/C-sharp/Pig-the-dice-game
new file mode 120000
index 0000000000..234ef64280
--- /dev/null
+++ b/Lang/C-sharp/Pig-the-dice-game
@@ -0,0 +1 @@
+../../Task/Pig-the-dice-game/C-sharp
\ No newline at end of file
diff --git a/Lang/C-sharp/Rock-paper-scissors b/Lang/C-sharp/Rock-paper-scissors
new file mode 120000
index 0000000000..2bc2de47dd
--- /dev/null
+++ b/Lang/C-sharp/Rock-paper-scissors
@@ -0,0 +1 @@
+../../Task/Rock-paper-scissors/C-sharp
\ No newline at end of file
diff --git a/Lang/COBOL/Binary-search b/Lang/COBOL/Binary-search
new file mode 120000
index 0000000000..3133d98503
--- /dev/null
+++ b/Lang/COBOL/Binary-search
@@ -0,0 +1 @@
+../../Task/Binary-search/COBOL
\ No newline at end of file
diff --git a/Lang/COBOL/Call-an-object-method b/Lang/COBOL/Call-an-object-method
new file mode 120000
index 0000000000..6a466f10ac
--- /dev/null
+++ b/Lang/COBOL/Call-an-object-method
@@ -0,0 +1 @@
+../../Task/Call-an-object-method/COBOL
\ No newline at end of file
diff --git a/Lang/COBOL/Count-in-octal b/Lang/COBOL/Count-in-octal
new file mode 120000
index 0000000000..255f1251d1
--- /dev/null
+++ b/Lang/COBOL/Count-in-octal
@@ -0,0 +1 @@
+../../Task/Count-in-octal/COBOL
\ No newline at end of file
diff --git a/Lang/COBOL/Day-of-the-week b/Lang/COBOL/Day-of-the-week
new file mode 120000
index 0000000000..f8dab226d9
--- /dev/null
+++ b/Lang/COBOL/Day-of-the-week
@@ -0,0 +1 @@
+../../Task/Day-of-the-week/COBOL
\ No newline at end of file
diff --git a/Lang/COBOL/Detect-division-by-zero b/Lang/COBOL/Detect-division-by-zero
new file mode 120000
index 0000000000..29b989b1ad
--- /dev/null
+++ b/Lang/COBOL/Detect-division-by-zero
@@ -0,0 +1 @@
+../../Task/Detect-division-by-zero/COBOL
\ No newline at end of file
diff --git a/Lang/COBOL/String-comparison b/Lang/COBOL/String-comparison
new file mode 120000
index 0000000000..8198369c4f
--- /dev/null
+++ b/Lang/COBOL/String-comparison
@@ -0,0 +1 @@
+../../Task/String-comparison/COBOL
\ No newline at end of file
diff --git a/Lang/Caml/00DESCRIPTION b/Lang/Caml/00DESCRIPTION
index d94f7c82fd..c6b60fb3cf 100644
--- a/Lang/Caml/00DESCRIPTION
+++ b/Lang/Caml/00DESCRIPTION
@@ -1,2 +1,5 @@
-{{language|Caml}}{{stub}}
+{{stub}}
+{{language|Caml
+|site=http://caml.inria.fr/
+}}
Relative of [[Standard ML]] that took a different path from the foundational [[derived from::ML]] language. It's derived language, [[OCaml]], is more well-known.
\ No newline at end of file
diff --git a/Lang/Clay/00DESCRIPTION b/Lang/Clay/00DESCRIPTION
index 213e3b6f94..74ee3f5b05 100644
--- a/Lang/Clay/00DESCRIPTION
+++ b/Lang/Clay/00DESCRIPTION
@@ -1,6 +1,6 @@
{{stub}}
{{language
-|site=http://tachyon.in/clay/
+|site=http://claylabs.com/clay/
}}
Clay is a systems programming language with whole program type propagation designed to support Generic programming.
It supports Multiple dispatch and compile time meta-programming. It does not have garbage collection
diff --git a/Lang/Clean/00DESCRIPTION b/Lang/Clean/00DESCRIPTION
index f8df15c3ef..71569c45c2 100644
--- a/Lang/Clean/00DESCRIPTION
+++ b/Lang/Clean/00DESCRIPTION
@@ -1,4 +1,5 @@
{{language|Clean
+|site=http://clean.cs.ru.nl
|strength=strong
|express=implicit
|checking=static
@@ -8,5 +9,4 @@
'''Clean''' is a pure and lazy functional [[programming language]].
==Citations==
-* [http://clean.cs.ru.nl/ The Clean web site]
* [[wp:Clean_%28programming_language%29|Wikipedia:Clean (programming language)]]
\ No newline at end of file
diff --git a/Lang/Clojure/Dinesmans-multiple-dwelling-problem b/Lang/Clojure/Dinesmans-multiple-dwelling-problem
new file mode 120000
index 0000000000..1bb40b6c2e
--- /dev/null
+++ b/Lang/Clojure/Dinesmans-multiple-dwelling-problem
@@ -0,0 +1 @@
+../../Task/Dinesmans-multiple-dwelling-problem/Clojure
\ No newline at end of file
diff --git a/Lang/Clojure/Empty-directory b/Lang/Clojure/Empty-directory
new file mode 120000
index 0000000000..2acf7a1b98
--- /dev/null
+++ b/Lang/Clojure/Empty-directory
@@ -0,0 +1 @@
+../../Task/Empty-directory/Clojure
\ No newline at end of file
diff --git a/Lang/Clojure/Fibonacci-n-step-number-sequences b/Lang/Clojure/Fibonacci-n-step-number-sequences
new file mode 120000
index 0000000000..a5193cffe5
--- /dev/null
+++ b/Lang/Clojure/Fibonacci-n-step-number-sequences
@@ -0,0 +1 @@
+../../Task/Fibonacci-n-step-number-sequences/Clojure
\ No newline at end of file
diff --git a/Lang/Clojure/Include-a-file b/Lang/Clojure/Include-a-file
new file mode 120000
index 0000000000..bff391d271
--- /dev/null
+++ b/Lang/Clojure/Include-a-file
@@ -0,0 +1 @@
+../../Task/Include-a-file/Clojure
\ No newline at end of file
diff --git a/Lang/Clojure/Inverted-index b/Lang/Clojure/Inverted-index
new file mode 120000
index 0000000000..36ab2f01c4
--- /dev/null
+++ b/Lang/Clojure/Inverted-index
@@ -0,0 +1 @@
+../../Task/Inverted-index/Clojure
\ No newline at end of file
diff --git a/Lang/Clojure/Modular-exponentiation b/Lang/Clojure/Modular-exponentiation
new file mode 120000
index 0000000000..0ccdd9e468
--- /dev/null
+++ b/Lang/Clojure/Modular-exponentiation
@@ -0,0 +1 @@
+../../Task/Modular-exponentiation/Clojure
\ No newline at end of file
diff --git a/Lang/Clojure/Subtractive-generator b/Lang/Clojure/Subtractive-generator
new file mode 120000
index 0000000000..71ef48677f
--- /dev/null
+++ b/Lang/Clojure/Subtractive-generator
@@ -0,0 +1 @@
+../../Task/Subtractive-generator/Clojure
\ No newline at end of file
diff --git a/Lang/Clojure/Universal-Turing-machine b/Lang/Clojure/Universal-Turing-machine
new file mode 120000
index 0000000000..4ccee36928
--- /dev/null
+++ b/Lang/Clojure/Universal-Turing-machine
@@ -0,0 +1 @@
+../../Task/Universal-Turing-machine/Clojure
\ No newline at end of file
diff --git a/Lang/Clojure/Zebra-puzzle b/Lang/Clojure/Zebra-puzzle
new file mode 120000
index 0000000000..d0e720e194
--- /dev/null
+++ b/Lang/Clojure/Zebra-puzzle
@@ -0,0 +1 @@
+../../Task/Zebra-puzzle/Clojure
\ No newline at end of file
diff --git a/Lang/Clojure/Zeckendorf-number-representation b/Lang/Clojure/Zeckendorf-number-representation
new file mode 120000
index 0000000000..6858862001
--- /dev/null
+++ b/Lang/Clojure/Zeckendorf-number-representation
@@ -0,0 +1 @@
+../../Task/Zeckendorf-number-representation/Clojure
\ No newline at end of file
diff --git a/Lang/CoffeeScript/00DESCRIPTION b/Lang/CoffeeScript/00DESCRIPTION
index 40c00d3966..08d9c62010 100644
--- a/Lang/CoffeeScript/00DESCRIPTION
+++ b/Lang/CoffeeScript/00DESCRIPTION
@@ -1,4 +1,7 @@
-{{language}}{{wikipedia|CoffeeScript}}'''CoffeeScript''' is a programming language that compiles to [[:Category:JavaScript|JavaScript]]. The language adds syntactic sugar inspired by [[:Category:Ruby|Ruby]] and [[:Category:Python|Python]] to enhance JavaScript's brevity and readability, as well as adding more sophisticated features like array comprehension and pattern matching.
+{{language|
+site=http://coffeescript.org
+}}
+{{wikipedia|CoffeeScript}}'''CoffeeScript''' is a programming language that compiles to [[:Category:JavaScript|JavaScript]]. The language adds syntactic sugar inspired by [[:Category:Ruby|Ruby]] and [[:Category:Python|Python]] to enhance JavaScript's brevity and readability, as well as adding more sophisticated features like array comprehension and pattern matching.
With 4000+ watchers and 300+ forks (as of December 2011), CoffeeScript is ranked as one of the "most interesting" projects on Github. [http://github.com/repositories] The language has a relatively large following in the Ruby community, and has been used in production by [http://thinkvitamin.com/mobile/new-rails-like-framework-from-37signals-for-html5-mobile-apps/ 37signals]. Ruby on Rails began to include CoffeeScript in its asset pipeline in Rails version 3.1 (see [http://www.rubyinside.com/rails-3-1-adopts-coffeescript-jquery-sass-and-controversy-4669.html]).
@@ -48,7 +51,6 @@ The CoffeeScript compiler has been written in CoffeeScript since version 0.5, an
# Ashkenas, Jeremy. "[http://github.com/jashkenas/coffee-script/issues/830 The Plan for 1.0]", Github issue tracker, Nov 4, 2010.
== External links ==
-* [http://coffeescript.org CoffeeScript.org] - Official site]
* [http://github.com/jashkenas/coffee-script/ GitHub repository]
* [http://twitter.com/coffeescript @CoffeeScript] - Twitter feed
* [[wp:coffeescript|Wikipedia Entry]]
diff --git a/Lang/CoffeeScript/Bitmap-Bresenhams-line-algorithm b/Lang/CoffeeScript/Bitmap-Bresenhams-line-algorithm
new file mode 120000
index 0000000000..5dbddaf4c6
--- /dev/null
+++ b/Lang/CoffeeScript/Bitmap-Bresenhams-line-algorithm
@@ -0,0 +1 @@
+../../Task/Bitmap-Bresenhams-line-algorithm/CoffeeScript
\ No newline at end of file
diff --git a/Lang/CoffeeScript/Entropy b/Lang/CoffeeScript/Entropy
new file mode 120000
index 0000000000..dd4ba0d681
--- /dev/null
+++ b/Lang/CoffeeScript/Entropy
@@ -0,0 +1 @@
+../../Task/Entropy/CoffeeScript
\ No newline at end of file
diff --git a/Lang/CoffeeScript/Program-name b/Lang/CoffeeScript/Program-name
new file mode 120000
index 0000000000..506230b32b
--- /dev/null
+++ b/Lang/CoffeeScript/Program-name
@@ -0,0 +1 @@
+../../Task/Program-name/CoffeeScript
\ No newline at end of file
diff --git a/Lang/Common-Lisp/Digital-root b/Lang/Common-Lisp/Digital-root
new file mode 120000
index 0000000000..d101188285
--- /dev/null
+++ b/Lang/Common-Lisp/Digital-root
@@ -0,0 +1 @@
+../../Task/Digital-root/Common-Lisp
\ No newline at end of file
diff --git a/Lang/Common-Lisp/Empty-directory b/Lang/Common-Lisp/Empty-directory
new file mode 120000
index 0000000000..a7323fbf67
--- /dev/null
+++ b/Lang/Common-Lisp/Empty-directory
@@ -0,0 +1 @@
+../../Task/Empty-directory/Common-Lisp
\ No newline at end of file
diff --git a/Lang/Common-Lisp/Include-a-file b/Lang/Common-Lisp/Include-a-file
new file mode 120000
index 0000000000..a829867e3c
--- /dev/null
+++ b/Lang/Common-Lisp/Include-a-file
@@ -0,0 +1 @@
+../../Task/Include-a-file/Common-Lisp
\ No newline at end of file
diff --git a/Lang/Common-Lisp/MD4 b/Lang/Common-Lisp/MD4
new file mode 120000
index 0000000000..5ddb1e6700
--- /dev/null
+++ b/Lang/Common-Lisp/MD4
@@ -0,0 +1 @@
+../../Task/MD4/Common-Lisp
\ No newline at end of file
diff --git a/Lang/Common-Lisp/Parsing-RPN-calculator-algorithm b/Lang/Common-Lisp/Parsing-RPN-calculator-algorithm
new file mode 120000
index 0000000000..b3c1629170
--- /dev/null
+++ b/Lang/Common-Lisp/Parsing-RPN-calculator-algorithm
@@ -0,0 +1 @@
+../../Task/Parsing-RPN-calculator-algorithm/Common-Lisp
\ No newline at end of file
diff --git a/Lang/Common-Lisp/RIPEMD-160 b/Lang/Common-Lisp/RIPEMD-160
new file mode 120000
index 0000000000..47fab82ba8
--- /dev/null
+++ b/Lang/Common-Lisp/RIPEMD-160
@@ -0,0 +1 @@
+../../Task/RIPEMD-160/Common-Lisp
\ No newline at end of file
diff --git a/Lang/Common-Lisp/SHA-256 b/Lang/Common-Lisp/SHA-256
new file mode 120000
index 0000000000..d6c3d1e04e
--- /dev/null
+++ b/Lang/Common-Lisp/SHA-256
@@ -0,0 +1 @@
+../../Task/SHA-256/Common-Lisp
\ No newline at end of file
diff --git a/Lang/Common-Lisp/Set-consolidation b/Lang/Common-Lisp/Set-consolidation
new file mode 120000
index 0000000000..64818e42f7
--- /dev/null
+++ b/Lang/Common-Lisp/Set-consolidation
@@ -0,0 +1 @@
+../../Task/Set-consolidation/Common-Lisp
\ No newline at end of file
diff --git a/Lang/Common-Lisp/Strip-comments-from-a-string b/Lang/Common-Lisp/Strip-comments-from-a-string
new file mode 120000
index 0000000000..9ac29ea43b
--- /dev/null
+++ b/Lang/Common-Lisp/Strip-comments-from-a-string
@@ -0,0 +1 @@
+../../Task/Strip-comments-from-a-string/Common-Lisp
\ No newline at end of file
diff --git a/Lang/Common-Lisp/Strip-whitespace-from-a-string-Top-and-tail b/Lang/Common-Lisp/Strip-whitespace-from-a-string-Top-and-tail
new file mode 120000
index 0000000000..aeba356cdc
--- /dev/null
+++ b/Lang/Common-Lisp/Strip-whitespace-from-a-string-Top-and-tail
@@ -0,0 +1 @@
+../../Task/Strip-whitespace-from-a-string-Top-and-tail/Common-Lisp
\ No newline at end of file
diff --git a/Lang/Common-Lisp/Substring-Top-and-tail b/Lang/Common-Lisp/Substring-Top-and-tail
new file mode 120000
index 0000000000..140209d4e6
--- /dev/null
+++ b/Lang/Common-Lisp/Substring-Top-and-tail
@@ -0,0 +1 @@
+../../Task/Substring-Top-and-tail/Common-Lisp
\ No newline at end of file
diff --git a/Lang/Coq/00DESCRIPTION b/Lang/Coq/00DESCRIPTION
index f366dcaecc..3a03214cba 100644
--- a/Lang/Coq/00DESCRIPTION
+++ b/Lang/Coq/00DESCRIPTION
@@ -1,4 +1,7 @@
-{{language|Coq}}In computer science, Coq is a proof assistant application. It allows the expression of mathematical assertions, mechanically checks proofs of these assertions, helps to find formal proofs, and extracts a certified program from the constructive proof of its formal specification. Coq works within the theory of the calculus of inductive constructions, a derivative of the calculus of constructions. Coq is not an automated [[wp:Theorem_prover|theorem prover]] but includes automatic theorem proving tactics and various decision procedures.
+{{language|Coq
+|site=http://coq.inria.fr
+}}
+In computer science, Coq is a proof assistant application. It allows the expression of mathematical assertions, mechanically checks proofs of these assertions, helps to find formal proofs, and extracts a certified program from the constructive proof of its formal specification. Coq works within the theory of the calculus of inductive constructions, a derivative of the calculus of constructions. Coq is not an automated [[wp:Theorem_prover|theorem prover]] but includes automatic theorem proving tactics and various decision procedures.
==Citations==
* [[wp:Coq|Coq]]
diff --git a/Lang/Coq/100-doors b/Lang/Coq/100-doors
new file mode 120000
index 0000000000..fd39f903ef
--- /dev/null
+++ b/Lang/Coq/100-doors
@@ -0,0 +1 @@
+../../Task/100-doors/Coq
\ No newline at end of file
diff --git a/Lang/D/Bitcoin-address-validation b/Lang/D/Bitcoin-address-validation
new file mode 120000
index 0000000000..688ed805c6
--- /dev/null
+++ b/Lang/D/Bitcoin-address-validation
@@ -0,0 +1 @@
+../../Task/Bitcoin-address-validation/D
\ No newline at end of file
diff --git a/Lang/D/Rendezvous b/Lang/D/Rendezvous
new file mode 120000
index 0000000000..7a9ac44daf
--- /dev/null
+++ b/Lang/D/Rendezvous
@@ -0,0 +1 @@
+../../Task/Rendezvous/D
\ No newline at end of file
diff --git a/Lang/D/SHA-256 b/Lang/D/SHA-256
new file mode 120000
index 0000000000..2aa4c30c6e
--- /dev/null
+++ b/Lang/D/SHA-256
@@ -0,0 +1 @@
+../../Task/SHA-256/D
\ No newline at end of file
diff --git a/Lang/D/Use-another-language-to-call-a-function b/Lang/D/Use-another-language-to-call-a-function
new file mode 120000
index 0000000000..4de62592fd
--- /dev/null
+++ b/Lang/D/Use-another-language-to-call-a-function
@@ -0,0 +1 @@
+../../Task/Use-another-language-to-call-a-function/D
\ No newline at end of file
diff --git a/Lang/Dart/Averages-Arithmetic-mean b/Lang/Dart/Averages-Arithmetic-mean
new file mode 120000
index 0000000000..b7027bfea6
--- /dev/null
+++ b/Lang/Dart/Averages-Arithmetic-mean
@@ -0,0 +1 @@
+../../Task/Averages-Arithmetic-mean/Dart
\ No newline at end of file
diff --git a/Lang/Dart/Dot-product b/Lang/Dart/Dot-product
new file mode 120000
index 0000000000..2cae4cd216
--- /dev/null
+++ b/Lang/Dart/Dot-product
@@ -0,0 +1 @@
+../../Task/Dot-product/Dart
\ No newline at end of file
diff --git a/Lang/Dart/Empty-string b/Lang/Dart/Empty-string
new file mode 120000
index 0000000000..021292b420
--- /dev/null
+++ b/Lang/Dart/Empty-string
@@ -0,0 +1 @@
+../../Task/Empty-string/Dart
\ No newline at end of file
diff --git a/Lang/Dart/HTTP b/Lang/Dart/HTTP
new file mode 120000
index 0000000000..14342e8d35
--- /dev/null
+++ b/Lang/Dart/HTTP
@@ -0,0 +1 @@
+../../Task/HTTP/Dart
\ No newline at end of file
diff --git a/Lang/Dart/Hello-world-Web-server b/Lang/Dart/Hello-world-Web-server
new file mode 120000
index 0000000000..6e5f95b7bb
--- /dev/null
+++ b/Lang/Dart/Hello-world-Web-server
@@ -0,0 +1 @@
+../../Task/Hello-world-Web-server/Dart
\ No newline at end of file
diff --git a/Lang/Dart/Perfect-numbers b/Lang/Dart/Perfect-numbers
new file mode 120000
index 0000000000..c1ec028a78
--- /dev/null
+++ b/Lang/Dart/Perfect-numbers
@@ -0,0 +1 @@
+../../Task/Perfect-numbers/Dart
\ No newline at end of file
diff --git a/Lang/Dart/Regular-expressions b/Lang/Dart/Regular-expressions
new file mode 120000
index 0000000000..0cdd9a85d0
--- /dev/null
+++ b/Lang/Dart/Regular-expressions
@@ -0,0 +1 @@
+../../Task/Regular-expressions/Dart
\ No newline at end of file
diff --git a/Lang/Dart/Set b/Lang/Dart/Set
new file mode 120000
index 0000000000..66fc475d01
--- /dev/null
+++ b/Lang/Dart/Set
@@ -0,0 +1 @@
+../../Task/Set/Dart
\ No newline at end of file
diff --git a/Lang/Deja-Vu/Count-occurrences-of-a-substring b/Lang/Deja-Vu/Count-occurrences-of-a-substring
new file mode 120000
index 0000000000..d79b559698
--- /dev/null
+++ b/Lang/Deja-Vu/Count-occurrences-of-a-substring
@@ -0,0 +1 @@
+../../Task/Count-occurrences-of-a-substring/Deja-Vu
\ No newline at end of file
diff --git a/Lang/Deja-Vu/Increment-a-numerical-string b/Lang/Deja-Vu/Increment-a-numerical-string
new file mode 120000
index 0000000000..7354670019
--- /dev/null
+++ b/Lang/Deja-Vu/Increment-a-numerical-string
@@ -0,0 +1 @@
+../../Task/Increment-a-numerical-string/Deja-Vu
\ No newline at end of file
diff --git a/Lang/Deja-Vu/Logical-operations b/Lang/Deja-Vu/Logical-operations
new file mode 120000
index 0000000000..d6fdc9db84
--- /dev/null
+++ b/Lang/Deja-Vu/Logical-operations
@@ -0,0 +1 @@
+../../Task/Logical-operations/Deja-Vu
\ No newline at end of file
diff --git a/Lang/Deja-Vu/One-dimensional-cellular-automata b/Lang/Deja-Vu/One-dimensional-cellular-automata
new file mode 120000
index 0000000000..7491ced43a
--- /dev/null
+++ b/Lang/Deja-Vu/One-dimensional-cellular-automata
@@ -0,0 +1 @@
+../../Task/One-dimensional-cellular-automata/Deja-Vu
\ No newline at end of file
diff --git a/Lang/Dylan/00DESCRIPTION b/Lang/Dylan/00DESCRIPTION
index 6eb93e5d6a..959e41da01 100644
--- a/Lang/Dylan/00DESCRIPTION
+++ b/Lang/Dylan/00DESCRIPTION
@@ -5,7 +5,7 @@
|checking=both
|gc=yes
|LCT=yes
-|site=http://www.opendylan.org/}}
+|site=http://opendylan.org/}}
{{language programming paradigm|functional}}
{{language programming paradigm|procedural}}
{{language programming paradigm|imperative}}
diff --git a/Lang/E/00DESCRIPTION b/Lang/E/00DESCRIPTION
index b614401b9f..99bab24e45 100644
--- a/Lang/E/00DESCRIPTION
+++ b/Lang/E/00DESCRIPTION
@@ -1,4 +1,5 @@
{{language
+|site=http://www.erights.org
|strength=strong
|safety=safe
|express=explicit
@@ -11,7 +12,7 @@
}}
E is a programming language designed around object-capability security and event-loop concurrency, in order to support creation of highly robust and secure programs.
-Using the [[Java]] implementation of E, Java libraries can be used from E code, and its REPL (e.g. [[Creating a Window]]).
+Using the [[Java]] implementation of E, Java libraries can be used from E code, and its REPL (e.g. [[Creating a Window#E|Creating a Window]]).
==Trying E==
@@ -43,6 +44,4 @@ This is both the format of a transcript at an E [[REPL]], and the format employe
To try out these examples for yourself, just install E and run the rune command to get the “?” prompt. Multi-line input is automatic for unbalanced brackets/parens and can be indicated in other cases by a trailing backslash.
==See Also==
-
-* [http://www.erights.org erights.org] — Home page of E
* [http://wiki.erights.org E Wiki]
\ No newline at end of file
diff --git a/Lang/Elan/00DESCRIPTION b/Lang/Elan/00DESCRIPTION
index 0fa3ef820b..5ec4d830b4 100644
--- a/Lang/Elan/00DESCRIPTION
+++ b/Lang/Elan/00DESCRIPTION
@@ -1,4 +1,2 @@
-{{language
-|site=http://www.loria.fr/equipes/protheo/SOFTWARES/ELAN/elan.html
-}}
+{{language}}
The ELAN system provides an environment for specifying and prototyping deduction systems in a language based on rules controlled by strategies. Its purpose is to support the design of theorem provers, logic programming languages, constraints solvers and decision procedures and to offer a modular framework for studying their combination.
\ No newline at end of file
diff --git a/Lang/Elena/00DESCRIPTION b/Lang/Elena/00DESCRIPTION
index 015c207823..a1372a9eac 100644
--- a/Lang/Elena/00DESCRIPTION
+++ b/Lang/Elena/00DESCRIPTION
@@ -1,4 +1,5 @@
{{language|Elena
+|site=http://elenalang.sourceforge.net
|exec=bytecode
|strength=strong
|safety=safe
diff --git a/Lang/Elixir/00DESCRIPTION b/Lang/Elixir/00DESCRIPTION
index 4d3d27c049..dea53dfdd5 100644
--- a/Lang/Elixir/00DESCRIPTION
+++ b/Lang/Elixir/00DESCRIPTION
@@ -1 +1,3 @@
-{{stub}}{{language}}
\ No newline at end of file
+{{stub}}
+{{language
+|site=http://elixir-lang.org}}
\ No newline at end of file
diff --git a/Lang/Emacs-Lisp/Ethiopian-multiplication b/Lang/Emacs-Lisp/Ethiopian-multiplication
new file mode 120000
index 0000000000..a0346f7ec2
--- /dev/null
+++ b/Lang/Emacs-Lisp/Ethiopian-multiplication
@@ -0,0 +1 @@
+../../Task/Ethiopian-multiplication/Emacs-Lisp
\ No newline at end of file
diff --git a/Lang/Epigram/00DESCRIPTION b/Lang/Epigram/00DESCRIPTION
index eb6dcdcef9..7f4196f576 100644
--- a/Lang/Epigram/00DESCRIPTION
+++ b/Lang/Epigram/00DESCRIPTION
@@ -1,3 +1,2 @@
-{{stub}}{{language|Epigram
-|site=http://www.e-pig.org/darcs/Pig09/web/}}
+{{stub}}{{language|Epigram}}
Epigram 2 is an experimental dependently typed functional programming language.
\ No newline at end of file
diff --git a/Lang/Erlang/00DESCRIPTION b/Lang/Erlang/00DESCRIPTION
index 037fd71f00..ceb0a08b89 100644
--- a/Lang/Erlang/00DESCRIPTION
+++ b/Lang/Erlang/00DESCRIPTION
@@ -1,11 +1,13 @@
{{language|Erlang
+|site=http://www.erlang.org
|exec=bytecode
|strength=strong
|safety=safe
|express=implicit
|checking=dynamic
|gc=yes
-|LCT=yes}}
+|LCT=yes
+|tags=erlang}}
{{language programming paradigm|functional}}
{{language programming paradigm|concurrent}}
{{language programming paradigm|distributed}}
diff --git a/Lang/Erlang/Forward-difference b/Lang/Erlang/Forward-difference
new file mode 120000
index 0000000000..4d80c48d11
--- /dev/null
+++ b/Lang/Erlang/Forward-difference
@@ -0,0 +1 @@
+../../Task/Forward-difference/Erlang
\ No newline at end of file
diff --git a/Lang/Erlang/Parsing-RPN-calculator-algorithm b/Lang/Erlang/Parsing-RPN-calculator-algorithm
new file mode 120000
index 0000000000..d8fc046704
--- /dev/null
+++ b/Lang/Erlang/Parsing-RPN-calculator-algorithm
@@ -0,0 +1 @@
+../../Task/Parsing-RPN-calculator-algorithm/Erlang
\ No newline at end of file
diff --git a/Lang/Euler-Math-Toolbox/00DESCRIPTION b/Lang/Euler-Math-Toolbox/00DESCRIPTION
index 114c13967e..e69de29bb2 100644
--- a/Lang/Euler-Math-Toolbox/00DESCRIPTION
+++ b/Lang/Euler-Math-Toolbox/00DESCRIPTION
@@ -1,6 +0,0 @@
-{{language
-|site=http://www.euler-math-toolbox.de/
-}}
-The Euler Mathematical Toolbox is a powerful, versatile, mature software for numerical and symbolic computations written and maintained by R. Grothmann, associate professor of mathmetics at the University of Eichstätt. Euler is similar to [[MATLAB]], but has an own style, and a slightly different syntax. Symbolic mathematics is supported in Euler using the open algebra system [[Maxima]]. It contains a matrix language, a graphical notebook style interface, a plot window and can handle real, complex and interval numbers, vectors and matrices, it can produce 2D/3D plots
-
-[[Category:Mathematical programming languages]]
\ No newline at end of file
diff --git a/Lang/F/00DESCRIPTION b/Lang/F/00DESCRIPTION
index e836ff79bb..2f3dce64c7 100644
--- a/Lang/F/00DESCRIPTION
+++ b/Lang/F/00DESCRIPTION
@@ -1,9 +1,10 @@
gecho is somewhat similar to FORTH. It will probably become less so as it grows.\ No newline at end of file diff --git a/Lang/Go/Table-creation-Postal-addresses b/Lang/Go/Table-creation-Postal-addresses new file mode 120000 index 0000000000..a6709beb88 --- /dev/null +++ b/Lang/Go/Table-creation-Postal-addresses @@ -0,0 +1 @@ +../../Task/Table-creation-Postal-addresses/Go \ No newline at end of file diff --git a/Lang/Groovy/GUI-Maximum-window-dimensions b/Lang/Groovy/GUI-Maximum-window-dimensions new file mode 120000 index 0000000000..737789bfcb --- /dev/null +++ b/Lang/Groovy/GUI-Maximum-window-dimensions @@ -0,0 +1 @@ +../../Task/GUI-Maximum-window-dimensions/Groovy \ No newline at end of file diff --git a/Lang/Groovy/LZW-compression b/Lang/Groovy/LZW-compression new file mode 120000 index 0000000000..6d88bb7f7f --- /dev/null +++ b/Lang/Groovy/LZW-compression @@ -0,0 +1 @@ +../../Task/LZW-compression/Groovy \ No newline at end of file diff --git a/Lang/Groovy/Modular-exponentiation b/Lang/Groovy/Modular-exponentiation new file mode 120000 index 0000000000..dace34a9be --- /dev/null +++ b/Lang/Groovy/Modular-exponentiation @@ -0,0 +1 @@ +../../Task/Modular-exponentiation/Groovy \ No newline at end of file diff --git a/Lang/Groovy/Partial-function-application b/Lang/Groovy/Partial-function-application new file mode 120000 index 0000000000..e30de30686 --- /dev/null +++ b/Lang/Groovy/Partial-function-application @@ -0,0 +1 @@ +../../Task/Partial-function-application/Groovy \ No newline at end of file diff --git a/Lang/HLA/00DESCRIPTION b/Lang/HLA/00DESCRIPTION index dcd7d7bafe..163b52623f 100644 --- a/Lang/HLA/00DESCRIPTION +++ b/Lang/HLA/00DESCRIPTION @@ -1,5 +1,5 @@ {{language|HLA -|site=http://homepage.mac.com/randyhyde/webster.cs.ucr.edu/HighLevelAsm/index.html +|site=http://www.plantation-productions.com/Webster/HighLevelAsm/index.html |exec=machine |gc=no |parampass=value diff --git a/Lang/HQ9+/00DESCRIPTION b/Lang/HQ9+/00DESCRIPTION index 0148cdc443..59e4bc00e1 100644 --- a/Lang/HQ9+/00DESCRIPTION +++ b/Lang/HQ9+/00DESCRIPTION @@ -2,10 +2,8 @@ |tags=hq9plus |hopl=no }}[[Category:Esoteric Languages]] -External description: [http://www.cliff.biffle.org/esoterica/hq9plus.html http://www.cliff.biffle.org/esoterica/hq9plus.html] (broken?) +[http://cliffle.com/esoterica/hq9plus.html Original blog article] by the language creator Cliff L. Biffle. -External description 2: [[eso:HQ9_Plus]] +[[eso:HQ9_Plus|Description]] on esolangs.org. -This language is notable in the context of Rosetta Code in that [[RCHQ9+]] is a task for implementing it. - -{{stub}} \ No newline at end of file +This language is notable in the context of Rosetta Code in that [[RCHQ9+]] is a task for implementing it. \ No newline at end of file diff --git a/Lang/Haskell/CRC-32 b/Lang/Haskell/CRC-32 new file mode 120000 index 0000000000..96d9eeeb2e --- /dev/null +++ b/Lang/Haskell/CRC-32 @@ -0,0 +1 @@ +../../Task/CRC-32/Haskell \ No newline at end of file diff --git a/Lang/Heron/00DESCRIPTION b/Lang/Heron/00DESCRIPTION index 75f3935fc6..ac718853cf 100644 --- a/Lang/Heron/00DESCRIPTION +++ b/Lang/Heron/00DESCRIPTION @@ -1,17 +1,14 @@ {{stub}} {{language -|site=http://www.heron-language.com/ +|site=http://code.google.com/p/heron-language/ }} Heron is a general-purpose object-oriented language, designed by Christopher Diggins, that strives to be appropriate for large scale project development (at least once it is mature). Heron borrows a number of ideas from functional languages, and offers some new twists on object-oriented programming.[[#Citation|[1]]] -Heron is influenced by the [[C++]], [[Java]] and [[Pascal]] programming languages. Heron has built-in support for object-oriented programming, generic programming, metaprogramming, aspect-oriented programming and design by contract techniques. The Heron language design goals include improving reusability of software and reduction of possibility of programmer error. Heron performance is tuned towards heavily polymorphic object-oriented designs.[[#Citation|[2]]] +Heron is influenced by the [[C++]], [[Java]] and [[Pascal]] programming languages. Heron has built-in support for object-oriented programming, generic programming, metaprogramming, aspect-oriented programming and design by contract techniques. The Heron language design goals include improving reusability of software and reduction of possibility of programmer error. Heron performance is tuned towards heavily polymorphic object-oriented designs. -Heron is effectively a combination of programming language and modeling language. It is designed to allow seamless transitioning between textual and diagrammatic representiation of executable UML (xUML) models. Heron is the first programming language designed specifically to support the model-driven architecture (MDA) paradigm.[[#Citation|[3]]] +Heron is effectively a combination of programming language and modeling language. It is designed to allow seamless transitioning between textual and diagrammatic representiation of executable UML (xUML) models. Heron is the first programming language designed specifically to support the model-driven architecture (MDA) paradigm. -Heron has a syntax which resembles [[Java]], [[C#]], [[ECMAScript]], and [[Scala]]. Heron is primarily an object-oriented language, but borrows many ideas from functional languages, and even some from array-oriented languages.[[#Citation|[4]]] +Heron has a syntax which resembles [[Java]], [[C#]], [[ECMAScript]], and [[Scala]]. Heron is primarily an object-oriented language, but borrows many ideas from functional languages, and even some from array-oriented languages. ==Citations== -# [http://www.artima.com/weblogs/viewpost.jsp?thread=284558 (Re-)Introducing the Heron Programming Language] -# [http://www.all-science-fair-projects.com/science_fair_projects_encyclopedia/Heron_programming_language Heron programming language] -# [http://www.heron-language.com/spec.html Heron Language Specification] -# [http://code.google.com/p/heron-language/ heron-language] \ No newline at end of file +# [http://www.artima.com/weblogs/viewpost.jsp?thread=284558 (Re-)Introducing the Heron Programming Language] \ No newline at end of file diff --git a/Lang/Hope/00DESCRIPTION b/Lang/Hope/00DESCRIPTION index 939b91ecd3..2dd544e6e6 100644 --- a/Lang/Hope/00DESCRIPTION +++ b/Lang/Hope/00DESCRIPTION @@ -1,4 +1,5 @@ {{language|Hope +|site=http://www.soi.city.ac.uk/~ross/Hope/ |strength=strong |safety=safe |compat=structural @@ -8,5 +9,5 @@ {{language programming paradigm|functional}} '''Hope''' is a purely [[functional programming]] language from 1970s, which predates Miranda and [[Haskell]]. It is the first language with call-by-pattern evaluation and algebraic data types, and its most used interpreter is fully [[lazy evaluation|lazy evaluated]]. -==Citations== +==See also== * [[wp:Hope_%28programming_language%29|Wikipedia:Hope (programming language)]] \ No newline at end of file diff --git a/Lang/Icon/Last-letter-first-letter b/Lang/Icon/Last-letter-first-letter new file mode 120000 index 0000000000..cec6cacdb8 --- /dev/null +++ b/Lang/Icon/Last-letter-first-letter @@ -0,0 +1 @@ +../../Task/Last-letter-first-letter/Icon \ No newline at end of file diff --git a/Lang/Icon/Sorting-algorithms-Radix-sort b/Lang/Icon/Sorting-algorithms-Radix-sort new file mode 120000 index 0000000000..2ae79edbe6 --- /dev/null +++ b/Lang/Icon/Sorting-algorithms-Radix-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Radix-sort/Icon \ No newline at end of file diff --git a/Lang/Icon/String-comparison b/Lang/Icon/String-comparison new file mode 120000 index 0000000000..6abc95a7bc --- /dev/null +++ b/Lang/Icon/String-comparison @@ -0,0 +1 @@ +../../Task/String-comparison/Icon \ No newline at end of file diff --git a/Lang/J/SHA-1 b/Lang/J/SHA-1 new file mode 120000 index 0000000000..2682faced4 --- /dev/null +++ b/Lang/J/SHA-1 @@ -0,0 +1 @@ +../../Task/SHA-1/J \ No newline at end of file diff --git a/Lang/Jabaco/00DESCRIPTION b/Lang/Jabaco/00DESCRIPTION index 96b8bf005c..1731bc0a63 100644 --- a/Lang/Jabaco/00DESCRIPTION +++ b/Lang/Jabaco/00DESCRIPTION @@ -1 +1,3 @@ -{{language}}{{Stub}} \ No newline at end of file +{{Stub}} +{{language| +site=http://www.jabaco.org}} \ No newline at end of file diff --git a/Lang/Java/00DESCRIPTION b/Lang/Java/00DESCRIPTION index 8db85901b9..71ff53eaa0 100644 --- a/Lang/Java/00DESCRIPTION +++ b/Lang/Java/00DESCRIPTION @@ -29,7 +29,7 @@ The primary benefits of Java are: Java is used in a variety of environments including desktop applications, embedded device (PDA and wireless phone) applications, server-side web page serving applications (as [[Java Server Pages|JSP]]), and applets embedded in web pages. -There are a variety of arguments regarding Java's performance compared to other popular languages like [[C++]]. Some come to the conclusion that the programmer's choices make a bigger difference on performance in each language. Most show that each language is better than the other at specific types of operations (i.e. Java for memory allocation, C++ for numerical operations). An extensive summary of comparisons between Java and C++ can be found [[wp:Comparison of Java and C++|on Wikipedia]]. +There are a variety of arguments regarding Java's performance compared to other popular languages like [[C++]]. Some come to the conclusion that the programmer's choices make a bigger difference on performance in each language. Most show that each language is better than the other at specific types of operations (e.g. Java for memory allocation, C++ for numerical operations). An extensive summary of comparisons between Java and C++ can be found [[wp:Comparison of Java and C++|on Wikipedia]]. According to some [http://www.tiobe.com/tpci.htm sources], Java is currently one of the most popular programming languages in the world. diff --git a/Lang/Java/Deal-cards-for-FreeCell b/Lang/Java/Deal-cards-for-FreeCell new file mode 120000 index 0000000000..94e068a838 --- /dev/null +++ b/Lang/Java/Deal-cards-for-FreeCell @@ -0,0 +1 @@ +../../Task/Deal-cards-for-FreeCell/Java \ No newline at end of file diff --git a/Lang/Java/Jensens-Device b/Lang/Java/Jensens-Device new file mode 120000 index 0000000000..92cf885295 --- /dev/null +++ b/Lang/Java/Jensens-Device @@ -0,0 +1 @@ +../../Task/Jensens-Device/Java \ No newline at end of file diff --git a/Lang/Java/Read-a-configuration-file b/Lang/Java/Read-a-configuration-file new file mode 120000 index 0000000000..ceea150e73 --- /dev/null +++ b/Lang/Java/Read-a-configuration-file @@ -0,0 +1 @@ +../../Task/Read-a-configuration-file/Java \ No newline at end of file diff --git a/Lang/JavaScript/Keyboard-input-Obtain-a-Y-or-N-response b/Lang/JavaScript/Keyboard-input-Obtain-a-Y-or-N-response new file mode 120000 index 0000000000..7f12877098 --- /dev/null +++ b/Lang/JavaScript/Keyboard-input-Obtain-a-Y-or-N-response @@ -0,0 +1 @@ +../../Task/Keyboard-input-Obtain-a-Y-or-N-response/JavaScript \ No newline at end of file diff --git a/Lang/JavaScript/Quaternion-type b/Lang/JavaScript/Quaternion-type new file mode 120000 index 0000000000..e2a6535526 --- /dev/null +++ b/Lang/JavaScript/Quaternion-type @@ -0,0 +1 @@ +../../Task/Quaternion-type/JavaScript \ No newline at end of file diff --git a/Lang/Joy/00DESCRIPTION b/Lang/Joy/00DESCRIPTION index e2565a3c6f..8a82f02c0a 100644 --- a/Lang/Joy/00DESCRIPTION +++ b/Lang/Joy/00DESCRIPTION @@ -2,7 +2,7 @@ |strength=strong |safety=safe |checking=dynamic -|site=http://www.latrobe.edu.au/phimvt/joy.html +|site=http://www.latrobe.edu.au/humanities/research/research-projects/past-projects/joy-programming-language |hopl id=2137 |LCT=yes}} {{language programming paradigm|concatenative}} diff --git a/Lang/JudoScript/00DESCRIPTION b/Lang/JudoScript/00DESCRIPTION index c3cf39cc64..29911f60c4 100644 --- a/Lang/JudoScript/00DESCRIPTION +++ b/Lang/JudoScript/00DESCRIPTION @@ -1,9 +1,8 @@ -{{language|JudoScript}}[[runs on vm::java virtual machine| ]] +{{language|JudoScript +|site=http://judoscript.org/judo.html}} +[[runs on vm::java virtual machine| ]] '''JudoScript''' is a scripting language based atop of [[Java]]. From the website: -:''Judo is a practical, functional scripting language. It is designed to cover the use cases of not only algorithmic/object-oriented/multi-threaded programming and Java scripting but also a number of major application domain tasks, such as scripting for JDBC, WSDL, ActiveX, OS, multiple file/data formats, etc. Despite its rich functionality, the base language is extremely simple, and domain support syntax is totally intuitive to domain experts, so that even though you have never programmed in Judo, you would have little trouble figuring out what the code does.'' - -==Citations== -* [http://www.judoscript.com/judo.html judoscript.com] \ No newline at end of file +:''Judo is a practical, functional scripting language. It is designed to cover the use cases of not only algorithmic/object-oriented/multi-threaded programming and Java scripting but also a number of major application domain tasks, such as scripting for JDBC, WSDL, ActiveX, OS, multiple file/data formats, etc. Despite its rich functionality, the base language is extremely simple, and domain support syntax is totally intuitive to domain experts, so that even though you have never programmed in Judo, you would have little trouble figuring out what the code does.'' \ No newline at end of file diff --git a/Lang/Julia/Averages-Mode b/Lang/Julia/Averages-Mode new file mode 120000 index 0000000000..bc5b729ba5 --- /dev/null +++ b/Lang/Julia/Averages-Mode @@ -0,0 +1 @@ +../../Task/Averages-Mode/Julia \ No newline at end of file diff --git a/Lang/Julia/Hello-world-Graphical b/Lang/Julia/Hello-world-Graphical new file mode 120000 index 0000000000..3dc071e3f0 --- /dev/null +++ b/Lang/Julia/Hello-world-Graphical @@ -0,0 +1 @@ +../../Task/Hello-world-Graphical/Julia \ No newline at end of file diff --git a/Lang/Julia/Josephus-problem b/Lang/Julia/Josephus-problem new file mode 120000 index 0000000000..1b19498380 --- /dev/null +++ b/Lang/Julia/Josephus-problem @@ -0,0 +1 @@ +../../Task/Josephus-problem/Julia \ No newline at end of file diff --git a/Lang/Julia/Leap-year b/Lang/Julia/Leap-year new file mode 120000 index 0000000000..565f2881e8 --- /dev/null +++ b/Lang/Julia/Leap-year @@ -0,0 +1 @@ +../../Task/Leap-year/Julia \ No newline at end of file diff --git a/Lang/Julia/Plot-coordinate-pairs b/Lang/Julia/Plot-coordinate-pairs new file mode 120000 index 0000000000..c495d01f3d --- /dev/null +++ b/Lang/Julia/Plot-coordinate-pairs @@ -0,0 +1 @@ +../../Task/Plot-coordinate-pairs/Julia \ No newline at end of file diff --git a/Lang/Julia/Sorting-algorithms-Quicksort b/Lang/Julia/Sorting-algorithms-Quicksort new file mode 120000 index 0000000000..bce8a7d2d2 --- /dev/null +++ b/Lang/Julia/Sorting-algorithms-Quicksort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Quicksort/Julia \ No newline at end of file diff --git a/Lang/K3d/00DESCRIPTION b/Lang/K3d/00DESCRIPTION index bca513bbcf..e69de29bb2 100644 --- a/Lang/K3d/00DESCRIPTION +++ b/Lang/K3d/00DESCRIPTION @@ -1,2 +0,0 @@ -{{stub}}{{language}} -The k3d cad system supports the use of scripts (typically written in python) for its operation. \ No newline at end of file diff --git a/Lang/Kotlin/100-doors b/Lang/Kotlin/100-doors new file mode 120000 index 0000000000..77f5518653 --- /dev/null +++ b/Lang/Kotlin/100-doors @@ -0,0 +1 @@ +../../Task/100-doors/Kotlin \ No newline at end of file diff --git a/Lang/Kotlin/Array-concatenation b/Lang/Kotlin/Array-concatenation new file mode 120000 index 0000000000..e6ff60a3d1 --- /dev/null +++ b/Lang/Kotlin/Array-concatenation @@ -0,0 +1 @@ +../../Task/Array-concatenation/Kotlin \ No newline at end of file diff --git a/Lang/Kotlin/GUI-component-interaction b/Lang/Kotlin/GUI-component-interaction new file mode 120000 index 0000000000..4c50eff4b1 --- /dev/null +++ b/Lang/Kotlin/GUI-component-interaction @@ -0,0 +1 @@ +../../Task/GUI-component-interaction/Kotlin \ No newline at end of file diff --git a/Lang/Kotlin/Hailstone-sequence b/Lang/Kotlin/Hailstone-sequence new file mode 120000 index 0000000000..2565a89277 --- /dev/null +++ b/Lang/Kotlin/Hailstone-sequence @@ -0,0 +1 @@ +../../Task/Hailstone-sequence/Kotlin \ No newline at end of file diff --git a/Lang/Kotlin/Hamming-numbers b/Lang/Kotlin/Hamming-numbers new file mode 120000 index 0000000000..0b6b078805 --- /dev/null +++ b/Lang/Kotlin/Hamming-numbers @@ -0,0 +1 @@ +../../Task/Hamming-numbers/Kotlin \ No newline at end of file diff --git a/Lang/Kotlin/Knights-tour b/Lang/Kotlin/Knights-tour new file mode 120000 index 0000000000..466d7ee7fb --- /dev/null +++ b/Lang/Kotlin/Knights-tour @@ -0,0 +1 @@ +../../Task/Knights-tour/Kotlin \ No newline at end of file diff --git a/Lang/Kotlin/Morse-code b/Lang/Kotlin/Morse-code new file mode 120000 index 0000000000..abeabd9dca --- /dev/null +++ b/Lang/Kotlin/Morse-code @@ -0,0 +1 @@ +../../Task/Morse-code/Kotlin \ No newline at end of file diff --git a/Lang/Kotlin/Read-a-configuration-file b/Lang/Kotlin/Read-a-configuration-file new file mode 120000 index 0000000000..9b7dfdd8bd --- /dev/null +++ b/Lang/Kotlin/Read-a-configuration-file @@ -0,0 +1 @@ +../../Task/Read-a-configuration-file/Kotlin \ No newline at end of file diff --git a/Lang/Kotlin/Sorting-algorithms-Bubble-sort b/Lang/Kotlin/Sorting-algorithms-Bubble-sort new file mode 120000 index 0000000000..fb7011e8dd --- /dev/null +++ b/Lang/Kotlin/Sorting-algorithms-Bubble-sort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Bubble-sort/Kotlin \ No newline at end of file diff --git a/Lang/Kotlin/Sorting-algorithms-Quicksort b/Lang/Kotlin/Sorting-algorithms-Quicksort new file mode 120000 index 0000000000..3c24845227 --- /dev/null +++ b/Lang/Kotlin/Sorting-algorithms-Quicksort @@ -0,0 +1 @@ +../../Task/Sorting-algorithms-Quicksort/Kotlin \ No newline at end of file diff --git a/Lang/Kotlin/Window-creation b/Lang/Kotlin/Window-creation new file mode 120000 index 0000000000..64ee1305a4 --- /dev/null +++ b/Lang/Kotlin/Window-creation @@ -0,0 +1 @@ +../../Task/Window-creation/Kotlin \ No newline at end of file diff --git a/Lang/LOLCODE/00DESCRIPTION b/Lang/LOLCODE/00DESCRIPTION index 2dd339db6b..1852f12c9d 100644 --- a/Lang/LOLCODE/00DESCRIPTION +++ b/Lang/LOLCODE/00DESCRIPTION @@ -1,2 +1,4 @@ -{{stub}}{{language|site=http://lolcode.com/}} +{{stub}} +{{language| +site=http://lolcode.org/}} [[Category:Esoteric Languages]] \ No newline at end of file diff --git a/Lang/LaTeX/00DESCRIPTION b/Lang/LaTeX/00DESCRIPTION index 80b612767b..e31cedce57 100644 --- a/Lang/LaTeX/00DESCRIPTION +++ b/Lang/LaTeX/00DESCRIPTION @@ -1,4 +1,6 @@ -{{language|LaTeX}}'''LaTeX''' is a document preparation language (markup language) written by Lamport (1985, 1994) to allow authors to create documents to be typeset using the [[TeX]] typesetting language (Knuth: 1978, 1982), without having to know the internal details of TeX. For further details please see the links below. +{{language|LaTeX +|site=http://latex-project.org/}} +'''LaTeX''' is a document preparation language (markup language) written by Lamport (1985, 1994) to allow authors to create documents to be typeset using the [[TeX]] typesetting language (Knuth: 1978, 1982), without having to know the internal details of TeX. For further details please see the links below. ==See Also== * [http://www.tug.org TeX Users Group] \ No newline at end of file diff --git a/Lang/LaTeX/FizzBuzz b/Lang/LaTeX/FizzBuzz new file mode 120000 index 0000000000..5476168fb0 --- /dev/null +++ b/Lang/LaTeX/FizzBuzz @@ -0,0 +1 @@ +../../Task/FizzBuzz/LaTeX \ No newline at end of file diff --git a/Lang/Limbo/00DESCRIPTION b/Lang/Limbo/00DESCRIPTION index 2d485ae370..cd01609666 100644 --- a/Lang/Limbo/00DESCRIPTION +++ b/Lang/Limbo/00DESCRIPTION @@ -3,7 +3,7 @@ |gc=yes }} -Limbo is the application programming language for Inferno. Syntactically similar to [[C]], it has several features that make it simpler, safer and yet more powerful and better suited to the development of concurrent, distributed systems. The Limbo compiler generates architecture independent object code which is then interpreted by the Inferno Virtual Machine or compiled just before runtime to improve performance. This ensures that Limbo applications are completely portable across all Inferno platforms.[[#Citation|[1]]] +Limbo is the application programming language for Inferno. Syntactically similar to [[C]], it has several features that make it simpler, safer and yet more powerful and better suited to the development of concurrent, distributed systems. The Limbo compiler generates architecture independent object code which is then interpreted by the Dis Virtual Machine or compiled just before runtime to improve performance. This ensures that Limbo applications are completely portable across all Inferno platforms.[[#Citation|[1]]] Limbo's approach to concurrency was inspired by Hoare's Communicating Sequential Processes ([[CSP]]).[[#Citation|[2]]] diff --git a/Lang/Limbo/Gamma-function b/Lang/Limbo/Gamma-function new file mode 120000 index 0000000000..4e52212e66 --- /dev/null +++ b/Lang/Limbo/Gamma-function @@ -0,0 +1 @@ +../../Task/Gamma-function/Limbo \ No newline at end of file diff --git a/Lang/Lua/MD4 b/Lang/Lua/MD4 new file mode 120000 index 0000000000..a14a7baffb --- /dev/null +++ b/Lang/Lua/MD4 @@ -0,0 +1 @@ +../../Task/MD4/Lua \ No newline at end of file diff --git a/Lang/Lua/RIPEMD-160 b/Lang/Lua/RIPEMD-160 new file mode 120000 index 0000000000..5a9b4f1c3d --- /dev/null +++ b/Lang/Lua/RIPEMD-160 @@ -0,0 +1 @@ +../../Task/RIPEMD-160/Lua \ No newline at end of file diff --git a/Lang/Lua/SHA-1 b/Lang/Lua/SHA-1 new file mode 120000 index 0000000000..ba96d458e3 --- /dev/null +++ b/Lang/Lua/SHA-1 @@ -0,0 +1 @@ +../../Task/SHA-1/Lua \ No newline at end of file diff --git a/Lang/Lua/SHA-256 b/Lang/Lua/SHA-256 new file mode 120000 index 0000000000..68c1c0f232 --- /dev/null +++ b/Lang/Lua/SHA-256 @@ -0,0 +1 @@ +../../Task/SHA-256/Lua \ No newline at end of file diff --git a/Lang/Lua/Sudoku b/Lang/Lua/Sudoku new file mode 120000 index 0000000000..a31ec81a1b --- /dev/null +++ b/Lang/Lua/Sudoku @@ -0,0 +1 @@ +../../Task/Sudoku/Lua \ No newline at end of file diff --git a/Lang/MATLAB/Include-a-file b/Lang/MATLAB/Include-a-file new file mode 120000 index 0000000000..583c0b8732 --- /dev/null +++ b/Lang/MATLAB/Include-a-file @@ -0,0 +1 @@ +../../Task/Include-a-file/MATLAB \ No newline at end of file diff --git a/Lang/MATLAB/Non-decimal-radices-Convert b/Lang/MATLAB/Non-decimal-radices-Convert new file mode 120000 index 0000000000..6f360b65cd --- /dev/null +++ b/Lang/MATLAB/Non-decimal-radices-Convert @@ -0,0 +1 @@ +../../Task/Non-decimal-radices-Convert/MATLAB \ No newline at end of file diff --git a/Lang/MATLAB/Standard-deviation b/Lang/MATLAB/Standard-deviation new file mode 120000 index 0000000000..6f5d2fe983 --- /dev/null +++ b/Lang/MATLAB/Standard-deviation @@ -0,0 +1 @@ +../../Task/Standard-deviation/MATLAB \ No newline at end of file diff --git a/Lang/ML-I/00DESCRIPTION b/Lang/ML-I/00DESCRIPTION index b5244bacab..c46ba37b18 100644 --- a/Lang/ML-I/00DESCRIPTION +++ b/Lang/ML-I/00DESCRIPTION @@ -1,10 +1,9 @@ -{{language|ML/I}} +{{language|ML/I +|site=http://www.ml1.org.uk}} ML/I is a general, stand alone, programmable macro processor. It is general in the sense that it can be used to process any kind of text. The text may be in any programming language or natural language, or it may be numerical data. It is stand alone in that it depends on no other program for its operation. It is programmable in that it can be programmed to carry out fairly complex operations when faced with varying kinds of input. In short, it is a very powerful tool. Historically, the most important use of ML/I has been to provide users with a simple means of adding extra statements (or other syntactic forms) to an existing programming language in order to make the language more suitable for their own field of application. This process of extension may be carried to the level where the extended language could be regarded as a new language in its own right. Other possible uses of ML/I are program parameterisation (e.g. a parameter might determine whether debugging statements are to be included in a program) and various applications in text editing or correction and in data format conversion. It has been used, for instance, to format and convert files marked up with HTML. It has also been used as part of a microprogam translator for a bit slice computer implementation. However, these are just a few applications. ML/I is very flexible, and there are many, many other uses for it. -ML/I is an exceedingly long-lived language. It was first implemented in 1966, and is still in use. - -The official ML/I web site can be found at [http://www.ml1.org.uk http://www.ml1.org.uk] \ No newline at end of file +ML/I is an exceedingly long-lived language. It was first implemented in 1966, and is still in use. \ No newline at end of file diff --git a/Lang/MPIF90/00DESCRIPTION b/Lang/MPIF90/00DESCRIPTION index 50cb6ba6d4..e69de29bb2 100644 --- a/Lang/MPIF90/00DESCRIPTION +++ b/Lang/MPIF90/00DESCRIPTION @@ -1 +0,0 @@ -{{language}}MPIf90 is the Message-passing interface for [[Fortran]] 90. See also mpif77, mpicc, etc. \ No newline at end of file diff --git a/Lang/Maple/00DESCRIPTION b/Lang/Maple/00DESCRIPTION index 36301ff907..dff6601ba1 100644 --- a/Lang/Maple/00DESCRIPTION +++ b/Lang/Maple/00DESCRIPTION @@ -1,3 +1,5 @@ -{{language}}{{stub}} +{{stub}} +{{language +|site=http://www.maplesoft.com/products/maple/}} [[Category:Mathematical programming languages]] \ No newline at end of file diff --git a/Lang/Maple/Anagrams-Deranged-anagrams b/Lang/Maple/Anagrams-Deranged-anagrams new file mode 120000 index 0000000000..92398830aa --- /dev/null +++ b/Lang/Maple/Anagrams-Deranged-anagrams @@ -0,0 +1 @@ +../../Task/Anagrams-Deranged-anagrams/Maple \ No newline at end of file diff --git a/Lang/Maple/Check-that-file-exists b/Lang/Maple/Check-that-file-exists new file mode 120000 index 0000000000..9a308a89f0 --- /dev/null +++ b/Lang/Maple/Check-that-file-exists @@ -0,0 +1 @@ +../../Task/Check-that-file-exists/Maple \ No newline at end of file diff --git a/Lang/Maple/Comments b/Lang/Maple/Comments new file mode 120000 index 0000000000..b5e33d80bb --- /dev/null +++ b/Lang/Maple/Comments @@ -0,0 +1 @@ +../../Task/Comments/Maple \ No newline at end of file diff --git a/Lang/Maple/Conditional-structures b/Lang/Maple/Conditional-structures new file mode 120000 index 0000000000..5707e420fb --- /dev/null +++ b/Lang/Maple/Conditional-structures @@ -0,0 +1 @@ +../../Task/Conditional-structures/Maple \ No newline at end of file diff --git a/Lang/Maple/Count-occurrences-of-a-substring b/Lang/Maple/Count-occurrences-of-a-substring new file mode 120000 index 0000000000..a2a5341f29 --- /dev/null +++ b/Lang/Maple/Count-occurrences-of-a-substring @@ -0,0 +1 @@ +../../Task/Count-occurrences-of-a-substring/Maple \ No newline at end of file diff --git a/Lang/Maple/Detect-division-by-zero b/Lang/Maple/Detect-division-by-zero new file mode 120000 index 0000000000..de7bf3db0a --- /dev/null +++ b/Lang/Maple/Detect-division-by-zero @@ -0,0 +1 @@ +../../Task/Detect-division-by-zero/Maple \ No newline at end of file diff --git a/Lang/Maple/Dot-product b/Lang/Maple/Dot-product new file mode 120000 index 0000000000..eea9f44d3d --- /dev/null +++ b/Lang/Maple/Dot-product @@ -0,0 +1 @@ +../../Task/Dot-product/Maple \ No newline at end of file diff --git a/Lang/Maple/Environment-variables b/Lang/Maple/Environment-variables new file mode 120000 index 0000000000..5f3fc0cae5 --- /dev/null +++ b/Lang/Maple/Environment-variables @@ -0,0 +1 @@ +../../Task/Environment-variables/Maple \ No newline at end of file diff --git a/Lang/Maple/Evaluate-binomial-coefficients b/Lang/Maple/Evaluate-binomial-coefficients new file mode 120000 index 0000000000..eb14d5d53e --- /dev/null +++ b/Lang/Maple/Evaluate-binomial-coefficients @@ -0,0 +1 @@ +../../Task/Evaluate-binomial-coefficients/Maple \ No newline at end of file diff --git a/Lang/Maple/Execute-a-system-command b/Lang/Maple/Execute-a-system-command new file mode 120000 index 0000000000..13ce44e34e --- /dev/null +++ b/Lang/Maple/Execute-a-system-command @@ -0,0 +1 @@ +../../Task/Execute-a-system-command/Maple \ No newline at end of file diff --git a/Lang/Maple/Factors-of-an-integer b/Lang/Maple/Factors-of-an-integer new file mode 120000 index 0000000000..5288c08533 --- /dev/null +++ b/Lang/Maple/Factors-of-an-integer @@ -0,0 +1 @@ +../../Task/Factors-of-an-integer/Maple \ No newline at end of file diff --git a/Lang/Maple/Fast-Fourier-transform b/Lang/Maple/Fast-Fourier-transform new file mode 120000 index 0000000000..c66f6d7424 --- /dev/null +++ b/Lang/Maple/Fast-Fourier-transform @@ -0,0 +1 @@ +../../Task/Fast-Fourier-transform/Maple \ No newline at end of file diff --git a/Lang/Maple/Flatten-a-list b/Lang/Maple/Flatten-a-list new file mode 120000 index 0000000000..82837a70b0 --- /dev/null +++ b/Lang/Maple/Flatten-a-list @@ -0,0 +1 @@ +../../Task/Flatten-a-list/Maple \ No newline at end of file diff --git a/Lang/Maple/Horners-rule-for-polynomial-evaluation b/Lang/Maple/Horners-rule-for-polynomial-evaluation new file mode 120000 index 0000000000..99e8843946 --- /dev/null +++ b/Lang/Maple/Horners-rule-for-polynomial-evaluation @@ -0,0 +1 @@ +../../Task/Horners-rule-for-polynomial-evaluation/Maple \ No newline at end of file diff --git a/Lang/Maple/Integer-sequence b/Lang/Maple/Integer-sequence new file mode 120000 index 0000000000..61b220fa27 --- /dev/null +++ b/Lang/Maple/Integer-sequence @@ -0,0 +1 @@ +../../Task/Integer-sequence/Maple \ No newline at end of file diff --git a/Lang/Maple/Interactive-programming b/Lang/Maple/Interactive-programming new file mode 120000 index 0000000000..a63fc97eed --- /dev/null +++ b/Lang/Maple/Interactive-programming @@ -0,0 +1 @@ +../../Task/Interactive-programming/Maple \ No newline at end of file diff --git a/Lang/Maple/LU-decomposition b/Lang/Maple/LU-decomposition new file mode 120000 index 0000000000..6546dac291 --- /dev/null +++ b/Lang/Maple/LU-decomposition @@ -0,0 +1 @@ +../../Task/LU-decomposition/Maple \ No newline at end of file diff --git a/Lang/Maple/Logical-operations b/Lang/Maple/Logical-operations new file mode 120000 index 0000000000..2b80af257e --- /dev/null +++ b/Lang/Maple/Logical-operations @@ -0,0 +1 @@ +../../Task/Logical-operations/Maple \ No newline at end of file diff --git a/Lang/Maple/Loops-For-with-a-specified-step b/Lang/Maple/Loops-For-with-a-specified-step new file mode 120000 index 0000000000..365e052f94 --- /dev/null +++ b/Lang/Maple/Loops-For-with-a-specified-step @@ -0,0 +1 @@ +../../Task/Loops-For-with-a-specified-step/Maple \ No newline at end of file diff --git a/Lang/Maple/Loops-Foreach b/Lang/Maple/Loops-Foreach new file mode 120000 index 0000000000..41fcf31acd --- /dev/null +++ b/Lang/Maple/Loops-Foreach @@ -0,0 +1 @@ +../../Task/Loops-Foreach/Maple \ No newline at end of file diff --git a/Lang/Maple/Loops-Nested b/Lang/Maple/Loops-Nested new file mode 120000 index 0000000000..98277b9709 --- /dev/null +++ b/Lang/Maple/Loops-Nested @@ -0,0 +1 @@ +../../Task/Loops-Nested/Maple \ No newline at end of file diff --git a/Lang/Maple/Matrix-arithmetic b/Lang/Maple/Matrix-arithmetic new file mode 120000 index 0000000000..ff2ce120e7 --- /dev/null +++ b/Lang/Maple/Matrix-arithmetic @@ -0,0 +1 @@ +../../Task/Matrix-arithmetic/Maple \ No newline at end of file diff --git a/Lang/Maple/Matrix-exponentiation-operator b/Lang/Maple/Matrix-exponentiation-operator new file mode 120000 index 0000000000..1b9416231f --- /dev/null +++ b/Lang/Maple/Matrix-exponentiation-operator @@ -0,0 +1 @@ +../../Task/Matrix-exponentiation-operator/Maple \ No newline at end of file diff --git a/Lang/Maple/Matrix-multiplication b/Lang/Maple/Matrix-multiplication new file mode 120000 index 0000000000..f605241a59 --- /dev/null +++ b/Lang/Maple/Matrix-multiplication @@ -0,0 +1 @@ +../../Task/Matrix-multiplication/Maple \ No newline at end of file diff --git a/Lang/Maple/Matrix-transposition b/Lang/Maple/Matrix-transposition new file mode 120000 index 0000000000..ba9650aa5a --- /dev/null +++ b/Lang/Maple/Matrix-transposition @@ -0,0 +1 @@ +../../Task/Matrix-transposition/Maple \ No newline at end of file diff --git a/Lang/Maple/Modular-inverse b/Lang/Maple/Modular-inverse new file mode 120000 index 0000000000..92f55e77d1 --- /dev/null +++ b/Lang/Maple/Modular-inverse @@ -0,0 +1 @@ +../../Task/Modular-inverse/Maple \ No newline at end of file diff --git a/Lang/Maple/Nth-root b/Lang/Maple/Nth-root new file mode 120000 index 0000000000..fb06275a31 --- /dev/null +++ b/Lang/Maple/Nth-root @@ -0,0 +1 @@ +../../Task/Nth-root/Maple \ No newline at end of file diff --git a/Lang/Maple/Palindrome-detection b/Lang/Maple/Palindrome-detection new file mode 120000 index 0000000000..17f0b198e2 --- /dev/null +++ b/Lang/Maple/Palindrome-detection @@ -0,0 +1 @@ +../../Task/Palindrome-detection/Maple \ No newline at end of file diff --git a/Lang/Maple/Power-set b/Lang/Maple/Power-set new file mode 120000 index 0000000000..47c529d1bb --- /dev/null +++ b/Lang/Maple/Power-set @@ -0,0 +1 @@ +../../Task/Power-set/Maple \ No newline at end of file diff --git a/Lang/Maple/Prime-decomposition b/Lang/Maple/Prime-decomposition new file mode 120000 index 0000000000..00cc4881d3 --- /dev/null +++ b/Lang/Maple/Prime-decomposition @@ -0,0 +1 @@ +../../Task/Prime-decomposition/Maple \ No newline at end of file diff --git a/Lang/Maple/QR-decomposition b/Lang/Maple/QR-decomposition new file mode 120000 index 0000000000..d4b8774529 --- /dev/null +++ b/Lang/Maple/QR-decomposition @@ -0,0 +1 @@ +../../Task/QR-decomposition/Maple \ No newline at end of file diff --git a/Lang/Maple/Reduced-row-echelon-form b/Lang/Maple/Reduced-row-echelon-form new file mode 120000 index 0000000000..4ad1595f3a --- /dev/null +++ b/Lang/Maple/Reduced-row-echelon-form @@ -0,0 +1 @@ +../../Task/Reduced-row-echelon-form/Maple \ No newline at end of file diff --git a/Lang/Maple/Roots-of-a-quadratic-function b/Lang/Maple/Roots-of-a-quadratic-function new file mode 120000 index 0000000000..3ea529ecc2 --- /dev/null +++ b/Lang/Maple/Roots-of-a-quadratic-function @@ -0,0 +1 @@ +../../Task/Roots-of-a-quadratic-function/Maple \ No newline at end of file diff --git a/Lang/Maple/Sleep b/Lang/Maple/Sleep new file mode 120000 index 0000000000..a6b2dd8b67 --- /dev/null +++ b/Lang/Maple/Sleep @@ -0,0 +1 @@ +../../Task/Sleep/Maple \ No newline at end of file diff --git a/Lang/Maple/Sort-an-integer-array b/Lang/Maple/Sort-an-integer-array new file mode 120000 index 0000000000..e26fd8fd94 --- /dev/null +++ b/Lang/Maple/Sort-an-integer-array @@ -0,0 +1 @@ +../../Task/Sort-an-integer-array/Maple \ No newline at end of file diff --git a/Lang/Maple/Stack b/Lang/Maple/Stack new file mode 120000 index 0000000000..dabb089b84 --- /dev/null +++ b/Lang/Maple/Stack @@ -0,0 +1 @@ +../../Task/Stack/Maple \ No newline at end of file diff --git a/Lang/Maple/String-case b/Lang/Maple/String-case new file mode 120000 index 0000000000..14c481791e --- /dev/null +++ b/Lang/Maple/String-case @@ -0,0 +1 @@ +../../Task/String-case/Maple \ No newline at end of file diff --git a/Lang/Maple/String-concatenation b/Lang/Maple/String-concatenation new file mode 120000 index 0000000000..b26d6f8367 --- /dev/null +++ b/Lang/Maple/String-concatenation @@ -0,0 +1 @@ +../../Task/String-concatenation/Maple \ No newline at end of file diff --git a/Lang/Maple/Strip-a-set-of-characters-from-a-string b/Lang/Maple/Strip-a-set-of-characters-from-a-string new file mode 120000 index 0000000000..945598e97d --- /dev/null +++ b/Lang/Maple/Strip-a-set-of-characters-from-a-string @@ -0,0 +1 @@ +../../Task/Strip-a-set-of-characters-from-a-string/Maple \ No newline at end of file diff --git a/Lang/Maple/Strip-whitespace-from-a-string-Top-and-tail b/Lang/Maple/Strip-whitespace-from-a-string-Top-and-tail new file mode 120000 index 0000000000..2e7d5d65e5 --- /dev/null +++ b/Lang/Maple/Strip-whitespace-from-a-string-Top-and-tail @@ -0,0 +1 @@ +../../Task/Strip-whitespace-from-a-string-Top-and-tail/Maple \ No newline at end of file diff --git a/Lang/Maple/Sum-of-squares b/Lang/Maple/Sum-of-squares new file mode 120000 index 0000000000..e72bcdea5e --- /dev/null +++ b/Lang/Maple/Sum-of-squares @@ -0,0 +1 @@ +../../Task/Sum-of-squares/Maple \ No newline at end of file diff --git a/Lang/Mathematica/00DESCRIPTION b/Lang/Mathematica/00DESCRIPTION index 604a261a34..c3b8387364 100644 --- a/Lang/Mathematica/00DESCRIPTION +++ b/Lang/Mathematica/00DESCRIPTION @@ -1,10 +1,9 @@ {{language|Mathematica +|site=https://www.wolfram.com/mathematica/ |strength=strong |checking=dynamic |gc=yes |LCT=yes}}{{implementation|Mathematica}}{{language programming paradigm|Declarative}}{{language programming paradigm|Functional}} -[[Mathematica]] is the name of Wolfram Research's mathematics analysis tool, as well as the name of the principal language used to control it. - -
NSArray, NSDictionary, NSNumber, and NSString, as well as subscript syntax to access elements of NSArray and NSDictionary.
+
+Unless otherwise stated, Objective-C code samples will assume that they are compiled with ARC enabled, and that the compiler supports Objective-C literals and Blocks.
pari.
+Android phones and tablets can use [https://code.google.com/p/paridroid/ paridroid] (also [https://github.com/FreeMonad/paridroid on github]).
+
+While an iPhone/iPad version has not been developed, [https://itunes.apple.com/us/app/sage-math/id496492945?mt=8 sage-math] includes PARI and GP commands can be invoked with the wrapper function pari.
+
+Finally, gp can be used online through [http://www.compileonline.com/execute_pari_online.php compile online] or the [https://cloud.sagemath.com/ SageMath cloud].
== Coding with PARI ==
The most common way to use PARI is through the gp calculator, using its own scripting language, GP. But there are other interfaces to PARI beside gp:
@@ -38,7 +42,8 @@ The most common way to use PARI is through the gp calculator, using its own scri
If you want to write a program rather than script a calculator, many languages are supported:
* [[C]]: PARI is written in C, so it's very easy to either write your own programs or extend gp using C.
-* [[C++]]: With appropriate linkage specification it is possible to use PARI directly in C++ as well. The code is intentionally written in a C++-compatible style.
+** For use with the Gnu Mpc library, there is also [http://www.multiprecision.org/?prog=pari-gnump Pari-Gnump].
+* [[C++]]: PARI can be used directly in C++. The code is intentionally written in a C++-compatible style. -fpermissive is sometimes useful when compiling with g++.
* [[Python]]: [http://www.sagemath.org/ SAGE] is a Python-based system that includes PARI among others; there is a [http://code.google.com/p/pari-python/ pari-python] library as well.
* [[Perl]]: Use [http://search.cpan.org/dist/Math-Pari/ Math::Pari] or [https://github.com/FreeMonad/GPP GPP].
* [[Common Lisp]]: Use [http://clisp.sourceforge.net/impnotes/pari.html Pari] ([[CLISP]]).
diff --git a/Lang/PARI-GP/Average-loop-length b/Lang/PARI-GP/Average-loop-length
new file mode 120000
index 0000000000..8b0605cde3
--- /dev/null
+++ b/Lang/PARI-GP/Average-loop-length
@@ -0,0 +1 @@
+../../Task/Average-loop-length/PARI-GP
\ No newline at end of file
diff --git a/Lang/PARI-GP/Binary-strings b/Lang/PARI-GP/Binary-strings
new file mode 120000
index 0000000000..3d10ecc6f7
--- /dev/null
+++ b/Lang/PARI-GP/Binary-strings
@@ -0,0 +1 @@
+../../Task/Binary-strings/PARI-GP
\ No newline at end of file
diff --git a/Lang/PARI-GP/Carmichael-3-strong-pseudoprimes b/Lang/PARI-GP/Carmichael-3-strong-pseudoprimes
new file mode 120000
index 0000000000..e2de0833c0
--- /dev/null
+++ b/Lang/PARI-GP/Carmichael-3-strong-pseudoprimes
@@ -0,0 +1 @@
+../../Task/Carmichael-3-strong-pseudoprimes/PARI-GP
\ No newline at end of file
diff --git a/Lang/PARI-GP/Continued-fraction-Arithmetic-Construct-from-rational-number b/Lang/PARI-GP/Continued-fraction-Arithmetic-Construct-from-rational-number
new file mode 120000
index 0000000000..607bfd46e5
--- /dev/null
+++ b/Lang/PARI-GP/Continued-fraction-Arithmetic-Construct-from-rational-number
@@ -0,0 +1 @@
+../../Task/Continued-fraction-Arithmetic-Construct-from-rational-number/PARI-GP
\ No newline at end of file
diff --git a/Lang/PARI-GP/Find-the-missing-permutation b/Lang/PARI-GP/Find-the-missing-permutation
new file mode 120000
index 0000000000..afb7b0bf07
--- /dev/null
+++ b/Lang/PARI-GP/Find-the-missing-permutation
@@ -0,0 +1 @@
+../../Task/Find-the-missing-permutation/PARI-GP
\ No newline at end of file
diff --git a/Lang/PARI-GP/Floyds-triangle b/Lang/PARI-GP/Floyds-triangle
new file mode 120000
index 0000000000..16f112a2d8
--- /dev/null
+++ b/Lang/PARI-GP/Floyds-triangle
@@ -0,0 +1 @@
+../../Task/Floyds-triangle/PARI-GP
\ No newline at end of file
diff --git a/Lang/PARI-GP/Forest-fire b/Lang/PARI-GP/Forest-fire
new file mode 120000
index 0000000000..9e28cdd36b
--- /dev/null
+++ b/Lang/PARI-GP/Forest-fire
@@ -0,0 +1 @@
+../../Task/Forest-fire/PARI-GP
\ No newline at end of file
diff --git a/Lang/PARI-GP/GUI-Maximum-window-dimensions b/Lang/PARI-GP/GUI-Maximum-window-dimensions
new file mode 120000
index 0000000000..9e92ee8042
--- /dev/null
+++ b/Lang/PARI-GP/GUI-Maximum-window-dimensions
@@ -0,0 +1 @@
+../../Task/GUI-Maximum-window-dimensions/PARI-GP
\ No newline at end of file
diff --git a/Lang/PARI-GP/Partial-function-application b/Lang/PARI-GP/Partial-function-application
new file mode 120000
index 0000000000..41e3368257
--- /dev/null
+++ b/Lang/PARI-GP/Partial-function-application
@@ -0,0 +1 @@
+../../Task/Partial-function-application/PARI-GP
\ No newline at end of file
diff --git a/Lang/PARI-GP/Show-the-epoch b/Lang/PARI-GP/Show-the-epoch
new file mode 120000
index 0000000000..61d181f368
--- /dev/null
+++ b/Lang/PARI-GP/Show-the-epoch
@@ -0,0 +1 @@
+../../Task/Show-the-epoch/PARI-GP
\ No newline at end of file
diff --git a/Lang/PARI-GP/Sierpinski-triangle b/Lang/PARI-GP/Sierpinski-triangle
new file mode 120000
index 0000000000..41eaece7e7
--- /dev/null
+++ b/Lang/PARI-GP/Sierpinski-triangle
@@ -0,0 +1 @@
+../../Task/Sierpinski-triangle/PARI-GP
\ No newline at end of file
diff --git a/Lang/PARI-GP/Topic-variable b/Lang/PARI-GP/Topic-variable
new file mode 120000
index 0000000000..85bdb23ab7
--- /dev/null
+++ b/Lang/PARI-GP/Topic-variable
@@ -0,0 +1 @@
+../../Task/Topic-variable/PARI-GP
\ No newline at end of file
diff --git a/Lang/PHP/LZW-compression b/Lang/PHP/LZW-compression
new file mode 120000
index 0000000000..895928d8a6
--- /dev/null
+++ b/Lang/PHP/LZW-compression
@@ -0,0 +1 @@
+../../Task/LZW-compression/PHP
\ No newline at end of file
diff --git a/Lang/PL-I/Carmichael-3-strong-pseudoprimes b/Lang/PL-I/Carmichael-3-strong-pseudoprimes
new file mode 120000
index 0000000000..1b709d5ff0
--- /dev/null
+++ b/Lang/PL-I/Carmichael-3-strong-pseudoprimes
@@ -0,0 +1 @@
+../../Task/Carmichael-3-strong-pseudoprimes/PL-I
\ No newline at end of file
diff --git a/Lang/PL-I/Gray-code b/Lang/PL-I/Gray-code
new file mode 120000
index 0000000000..98be8ae049
--- /dev/null
+++ b/Lang/PL-I/Gray-code
@@ -0,0 +1 @@
+../../Task/Gray-code/PL-I
\ No newline at end of file
diff --git a/Lang/PL-I/Keyboard-input-Obtain-a-Y-or-N-response b/Lang/PL-I/Keyboard-input-Obtain-a-Y-or-N-response
new file mode 120000
index 0000000000..a3c5cd38ed
--- /dev/null
+++ b/Lang/PL-I/Keyboard-input-Obtain-a-Y-or-N-response
@@ -0,0 +1 @@
+../../Task/Keyboard-input-Obtain-a-Y-or-N-response/PL-I
\ No newline at end of file
diff --git a/Lang/PL-I/Pythagorean-triples b/Lang/PL-I/Pythagorean-triples
new file mode 120000
index 0000000000..be9753aad8
--- /dev/null
+++ b/Lang/PL-I/Pythagorean-triples
@@ -0,0 +1 @@
+../../Task/Pythagorean-triples/PL-I
\ No newline at end of file
diff --git a/Lang/PL-SQL/Top-rank-per-group b/Lang/PL-SQL/Top-rank-per-group
new file mode 120000
index 0000000000..e1679951fd
--- /dev/null
+++ b/Lang/PL-SQL/Top-rank-per-group
@@ -0,0 +1 @@
+../../Task/Top-rank-per-group/PL-SQL
\ No newline at end of file
diff --git a/Lang/POV-Ray/00DESCRIPTION b/Lang/POV-Ray/00DESCRIPTION
index 6dee331070..45055290c2 100644
--- a/Lang/POV-Ray/00DESCRIPTION
+++ b/Lang/POV-Ray/00DESCRIPTION
@@ -1,8 +1,9 @@
+{{stub}}
{{language
|exec=interpreted
|site=http://www.povray.org
|
-}}{{stub}}
+}}
'''POV-Ray''' is a raytracer where images are specified in a description language. This description language also has programming constructs, making it a full-fledged programming language.
==Citation==
diff --git a/Lang/Pascal/Digital-root b/Lang/Pascal/Digital-root
new file mode 120000
index 0000000000..7211db0ca2
--- /dev/null
+++ b/Lang/Pascal/Digital-root
@@ -0,0 +1 @@
+../../Task/Digital-root/Pascal
\ No newline at end of file
diff --git a/Lang/Pascal/Range-extraction b/Lang/Pascal/Range-extraction
new file mode 120000
index 0000000000..62b5d4a193
--- /dev/null
+++ b/Lang/Pascal/Range-extraction
@@ -0,0 +1 @@
+../../Task/Range-extraction/Pascal
\ No newline at end of file
diff --git a/Lang/Pascal/Remove-lines-from-a-file b/Lang/Pascal/Remove-lines-from-a-file
new file mode 120000
index 0000000000..6ca2b09310
--- /dev/null
+++ b/Lang/Pascal/Remove-lines-from-a-file
@@ -0,0 +1 @@
+../../Task/Remove-lines-from-a-file/Pascal
\ No newline at end of file
diff --git a/Lang/Pascal/Soundex b/Lang/Pascal/Soundex
new file mode 120000
index 0000000000..4ea00227ca
--- /dev/null
+++ b/Lang/Pascal/Soundex
@@ -0,0 +1 @@
+../../Task/Soundex/Pascal
\ No newline at end of file
diff --git a/Lang/Perl-6/I-before-E-except-after-C b/Lang/Perl-6/I-before-E-except-after-C
new file mode 120000
index 0000000000..98f8a71253
--- /dev/null
+++ b/Lang/Perl-6/I-before-E-except-after-C
@@ -0,0 +1 @@
+../../Task/I-before-E-except-after-C/Perl-6
\ No newline at end of file
diff --git a/Lang/Perl-6/Memory-layout-of-a-data-structure b/Lang/Perl-6/Memory-layout-of-a-data-structure
new file mode 120000
index 0000000000..6d4293e475
--- /dev/null
+++ b/Lang/Perl-6/Memory-layout-of-a-data-structure
@@ -0,0 +1 @@
+../../Task/Memory-layout-of-a-data-structure/Perl-6
\ No newline at end of file
diff --git a/Lang/Perl-6/Parsing-Shunting-yard-algorithm b/Lang/Perl-6/Parsing-Shunting-yard-algorithm
new file mode 120000
index 0000000000..2803570bf5
--- /dev/null
+++ b/Lang/Perl-6/Parsing-Shunting-yard-algorithm
@@ -0,0 +1 @@
+../../Task/Parsing-Shunting-yard-algorithm/Perl-6
\ No newline at end of file
diff --git a/Lang/Perl-6/XML-Input b/Lang/Perl-6/XML-Input
new file mode 120000
index 0000000000..7d7e79a3c9
--- /dev/null
+++ b/Lang/Perl-6/XML-Input
@@ -0,0 +1 @@
+../../Task/XML-Input/Perl-6
\ No newline at end of file
diff --git a/Lang/Perl/00DESCRIPTION b/Lang/Perl/00DESCRIPTION
index 3e976e8802..15dcfd719e 100644
--- a/Lang/Perl/00DESCRIPTION
+++ b/Lang/Perl/00DESCRIPTION
@@ -1,4 +1,5 @@
{{language
+|site=http://www.perl.org/
|exec=bytecode
|strength=weak
|express=implicit
diff --git a/Lang/Perl/Draw-a-sphere b/Lang/Perl/Draw-a-sphere
new file mode 120000
index 0000000000..676d822c9e
--- /dev/null
+++ b/Lang/Perl/Draw-a-sphere
@@ -0,0 +1 @@
+../../Task/Draw-a-sphere/Perl
\ No newline at end of file
diff --git a/Lang/Perl/Parsing-Shunting-yard-algorithm b/Lang/Perl/Parsing-Shunting-yard-algorithm
new file mode 120000
index 0000000000..ae9cd357d9
--- /dev/null
+++ b/Lang/Perl/Parsing-Shunting-yard-algorithm
@@ -0,0 +1 @@
+../../Task/Parsing-Shunting-yard-algorithm/Perl
\ No newline at end of file
diff --git a/Lang/Perl/String-comparison b/Lang/Perl/String-comparison
new file mode 120000
index 0000000000..41a8fa3fb7
--- /dev/null
+++ b/Lang/Perl/String-comparison
@@ -0,0 +1 @@
+../../Task/String-comparison/Perl
\ No newline at end of file
diff --git a/Lang/Perl/Tic-tac-toe b/Lang/Perl/Tic-tac-toe
new file mode 120000
index 0000000000..526d19c878
--- /dev/null
+++ b/Lang/Perl/Tic-tac-toe
@@ -0,0 +1 @@
+../../Task/Tic-tac-toe/Perl
\ No newline at end of file
diff --git a/Lang/Pike/00DESCRIPTION b/Lang/Pike/00DESCRIPTION
index 6a9f781bb5..719882440c 100644
--- a/Lang/Pike/00DESCRIPTION
+++ b/Lang/Pike/00DESCRIPTION
@@ -1,6 +1,6 @@
{{language|Pike
|exec=bytecode
-|site=http://pike.ida.liu.se/
+|site=http://pike.lysator.liu.se/
|strength=strong
|safety=safe
|compat=structural
@@ -11,7 +11,7 @@
|LCT=yes}}
{{language programming paradigm|Object-oriented}}
-From the official [http://pike.ida.liu.se web site], Pike is an interpreted, general-purpose, high-level, cross-platform, dynamic programming language, with a syntax similar to [[Java]] and [[C]].
+From the official [http://pike.lysator.liu.se web site], Pike is an interpreted, general-purpose, high-level, cross-platform, dynamic programming language, with a syntax similar to [[Java]] and [[C]].
==See also==
* [[wp:Pike_(programming_language)|Pike on Wikipedia]]
\ No newline at end of file
diff --git a/Lang/PowerShell/Digital-root b/Lang/PowerShell/Digital-root
new file mode 120000
index 0000000000..49d6ada060
--- /dev/null
+++ b/Lang/PowerShell/Digital-root
@@ -0,0 +1 @@
+../../Task/Digital-root/PowerShell
\ No newline at end of file
diff --git a/Lang/PowerShell/Hailstone-sequence b/Lang/PowerShell/Hailstone-sequence
new file mode 120000
index 0000000000..112121b9dd
--- /dev/null
+++ b/Lang/PowerShell/Hailstone-sequence
@@ -0,0 +1 @@
+../../Task/Hailstone-sequence/PowerShell
\ No newline at end of file
diff --git a/Lang/PowerShell/I-before-E-except-after-C b/Lang/PowerShell/I-before-E-except-after-C
new file mode 120000
index 0000000000..1f9c1e376a
--- /dev/null
+++ b/Lang/PowerShell/I-before-E-except-after-C
@@ -0,0 +1 @@
+../../Task/I-before-E-except-after-C/PowerShell
\ No newline at end of file
diff --git a/Lang/PowerShell/Input-loop b/Lang/PowerShell/Input-loop
new file mode 120000
index 0000000000..d7ac3040fa
--- /dev/null
+++ b/Lang/PowerShell/Input-loop
@@ -0,0 +1 @@
+../../Task/Input-loop/PowerShell
\ No newline at end of file
diff --git a/Lang/PowerShell/Integer-sequence b/Lang/PowerShell/Integer-sequence
new file mode 120000
index 0000000000..46b16d03c6
--- /dev/null
+++ b/Lang/PowerShell/Integer-sequence
@@ -0,0 +1 @@
+../../Task/Integer-sequence/PowerShell
\ No newline at end of file
diff --git a/Lang/PowerShell/Read-a-file-line-by-line b/Lang/PowerShell/Read-a-file-line-by-line
new file mode 120000
index 0000000000..ea049ab76d
--- /dev/null
+++ b/Lang/PowerShell/Read-a-file-line-by-line
@@ -0,0 +1 @@
+../../Task/Read-a-file-line-by-line/PowerShell
\ No newline at end of file
diff --git a/Lang/PowerShell/Read-a-specific-line-from-a-file b/Lang/PowerShell/Read-a-specific-line-from-a-file
new file mode 120000
index 0000000000..5083c8a341
--- /dev/null
+++ b/Lang/PowerShell/Read-a-specific-line-from-a-file
@@ -0,0 +1 @@
+../../Task/Read-a-specific-line-from-a-file/PowerShell
\ No newline at end of file
diff --git a/Lang/PowerShell/SHA-1 b/Lang/PowerShell/SHA-1
new file mode 120000
index 0000000000..2a6d1f5629
--- /dev/null
+++ b/Lang/PowerShell/SHA-1
@@ -0,0 +1 @@
+../../Task/SHA-1/PowerShell
\ No newline at end of file
diff --git a/Lang/PowerShell/Sum-digits-of-an-integer b/Lang/PowerShell/Sum-digits-of-an-integer
new file mode 120000
index 0000000000..8b2c5e079f
--- /dev/null
+++ b/Lang/PowerShell/Sum-digits-of-an-integer
@@ -0,0 +1 @@
+../../Task/Sum-digits-of-an-integer/PowerShell
\ No newline at end of file
diff --git a/Lang/Prolog/Associative-array-Iteration b/Lang/Prolog/Associative-array-Iteration
new file mode 120000
index 0000000000..6f5b96f781
--- /dev/null
+++ b/Lang/Prolog/Associative-array-Iteration
@@ -0,0 +1 @@
+../../Task/Associative-array-Iteration/Prolog
\ No newline at end of file
diff --git a/Lang/Prolog/Even-or-odd b/Lang/Prolog/Even-or-odd
new file mode 120000
index 0000000000..3667062c4a
--- /dev/null
+++ b/Lang/Prolog/Even-or-odd
@@ -0,0 +1 @@
+../../Task/Even-or-odd/Prolog
\ No newline at end of file
diff --git a/Lang/Prolog/Shell-one-liner b/Lang/Prolog/Shell-one-liner
new file mode 120000
index 0000000000..3e55165691
--- /dev/null
+++ b/Lang/Prolog/Shell-one-liner
@@ -0,0 +1 @@
+../../Task/Shell-one-liner/Prolog
\ No newline at end of file
diff --git a/Lang/Prolog/Variadic-function b/Lang/Prolog/Variadic-function
new file mode 120000
index 0000000000..b69e370cf3
--- /dev/null
+++ b/Lang/Prolog/Variadic-function
@@ -0,0 +1 @@
+../../Task/Variadic-function/Prolog
\ No newline at end of file
diff --git a/Lang/Pure-Data/00DESCRIPTION b/Lang/Pure-Data/00DESCRIPTION
index 86052767ae..684b02a343 100644
--- a/Lang/Pure-Data/00DESCRIPTION
+++ b/Lang/Pure-Data/00DESCRIPTION
@@ -1,5 +1,6 @@
{{stub}}
-{{language
-|site=http://puredata.info/
-}}
-Pd (aka Pure Data) is a real-time graphical programming environment for audio, video, and graphical processing.
\ No newline at end of file
+{{language|Pure Data
+|site=http://puredata.info}}
+Pd (aka Pure Data) is a real-time graphical programming environment for audio, video, and graphical processing.
+
+Pure Data (aka Pd) is an open source visual programming language. Pd enables musicians, visual artists, performers, researchers, and developers to create software graphically, without writing lines of code.
\ No newline at end of file
diff --git a/Lang/Pure/00DESCRIPTION b/Lang/Pure/00DESCRIPTION
index 9a23a85244..617d87e28a 100644
--- a/Lang/Pure/00DESCRIPTION
+++ b/Lang/Pure/00DESCRIPTION
@@ -1,12 +1,12 @@
{{language|Pure
-|site=http://code.google.com/p/pure-lang/
+|site=http://purelang.bitbucket.org/
|compat=structural
|checking=dynamic
|strength=strong
|gc=yes
|LCT=yes}}{{language programming paradigm|Dynamic}}{{language programming paradigm|Functional}}
-From the official [http://pure-lang.googlecode.com/svn/docs/pure.html Pure manual]: "Pure is a modern-style functional programming language based on term rewriting. Pure programs are basically collections of equational rules used to evaluate expressions in a symbolic fashion by reducing them to normal form."
+From the official [http://puredocs.bitbucket.org/pure.html Pure manual]: "Pure is a modern-style functional programming language based on term rewriting. Pure programs are basically collections of equational rules used to evaluate expressions in a symbolic fashion by reducing them to normal form."
The Pure interpreter uses LLVM to JIT-compile code; in addition, Pure programs can be compiled with LLVM to machine code as well.
diff --git a/Lang/R/Knights-tour b/Lang/R/Knights-tour
new file mode 120000
index 0000000000..01ae018f65
--- /dev/null
+++ b/Lang/R/Knights-tour
@@ -0,0 +1 @@
+../../Task/Knights-tour/R
\ No newline at end of file
diff --git a/Lang/REXX/Empty-directory b/Lang/REXX/Empty-directory
new file mode 120000
index 0000000000..b3c2bdb9ec
--- /dev/null
+++ b/Lang/REXX/Empty-directory
@@ -0,0 +1 @@
+../../Task/Empty-directory/REXX
\ No newline at end of file
diff --git a/Lang/REXX/Events b/Lang/REXX/Events
new file mode 120000
index 0000000000..0bab154e0b
--- /dev/null
+++ b/Lang/REXX/Events
@@ -0,0 +1 @@
+../../Task/Events/REXX
\ No newline at end of file
diff --git a/Lang/REXX/Plot-coordinate-pairs b/Lang/REXX/Plot-coordinate-pairs
new file mode 120000
index 0000000000..e6ab9ed372
--- /dev/null
+++ b/Lang/REXX/Plot-coordinate-pairs
@@ -0,0 +1 @@
+../../Task/Plot-coordinate-pairs/REXX
\ No newline at end of file
diff --git a/Lang/REXX/Verify-distribution-uniformity-Naive b/Lang/REXX/Verify-distribution-uniformity-Naive
new file mode 120000
index 0000000000..1a64089c18
--- /dev/null
+++ b/Lang/REXX/Verify-distribution-uniformity-Naive
@@ -0,0 +1 @@
+../../Task/Verify-distribution-uniformity-Naive/REXX
\ No newline at end of file
diff --git a/Lang/REXX/Walk-a-directory-Non-recursively b/Lang/REXX/Walk-a-directory-Non-recursively
new file mode 120000
index 0000000000..02983994e2
--- /dev/null
+++ b/Lang/REXX/Walk-a-directory-Non-recursively
@@ -0,0 +1 @@
+../../Task/Walk-a-directory-Non-recursively/REXX
\ No newline at end of file
diff --git a/Lang/REXX/Walk-a-directory-Recursively b/Lang/REXX/Walk-a-directory-Recursively
new file mode 120000
index 0000000000..f93df4f865
--- /dev/null
+++ b/Lang/REXX/Walk-a-directory-Recursively
@@ -0,0 +1 @@
+../../Task/Walk-a-directory-Recursively/REXX
\ No newline at end of file
diff --git a/Lang/RTSL/00DESCRIPTION b/Lang/RTSL/00DESCRIPTION
index 2e3e3d5295..9deddfa6e6 100644
--- a/Lang/RTSL/00DESCRIPTION
+++ b/Lang/RTSL/00DESCRIPTION
@@ -1,7 +1,5 @@
-{{language
-|site=http://citeseerx.ist.psu.edu/
-}}
-
+{{language}}
RTSL is a domain specific programming language for extending ray tracing systems.
+See also: [http://www.cs.utah.edu/~boulos/papers/rtsl.pdf "RTSL: a Ray Tracing Shading Language" (Parker, Boulos, Bigler, Robison)]
[[Category:Raytracing]]
\ No newline at end of file
diff --git a/Lang/RapidQ/00DESCRIPTION b/Lang/RapidQ/00DESCRIPTION
index 2bd6564940..be9d29a8ae 100644
--- a/Lang/RapidQ/00DESCRIPTION
+++ b/Lang/RapidQ/00DESCRIPTION
@@ -1,4 +1,5 @@
{{language|RapidQ
+|site=http://rapidq.webcindario.com/index.html
|strength=strong
|safety=safe
|checking=static
diff --git a/Lang/Raven/00DESCRIPTION b/Lang/Raven/00DESCRIPTION
index a500b93e07..6e3aed39c7 100644
--- a/Lang/Raven/00DESCRIPTION
+++ b/Lang/Raven/00DESCRIPTION
@@ -1,4 +1,6 @@
-{{language|Raven}}Raven is an eclectic language with features derived from [[derived from::Python]], [[derived from::Forth]], and [[derived from::Perl]]. It was developed independently by [[User:Mythago|Sean Pringle]]. Raven is available from [http://aerosuidae.net aerosuidae.net] under the GNU General Public License. It is currently only available for the [[runs on::Linux]] platform.
+{{language|Raven
+|site=http://aerosuidae.net/raven.html}}
+Raven is an eclectic language with features derived from [[derived from::Python]], [[derived from::Forth]], and [[derived from::Perl]]. It was developed independently by [[User:Mythago|Sean Pringle]]. Raven is available from [http://aerosuidae.net aerosuidae.net] under the GNU General Public License. It is currently only available for the [[runs on::Linux]] platform.
==Features==
Its described feature set includes:
diff --git a/Lang/Refal/00DESCRIPTION b/Lang/Refal/00DESCRIPTION
index f66cf163bf..ac95bf6da2 100644
--- a/Lang/Refal/00DESCRIPTION
+++ b/Lang/Refal/00DESCRIPTION
@@ -1 +1,3 @@
-{{language}}{{stub}}
\ No newline at end of file
+{{stub}}
+{{language
+|site=http://www.refal.net/index_e.htm}}
\ No newline at end of file
diff --git a/Lang/Ruby/Averages-Mean-time-of-day b/Lang/Ruby/Averages-Mean-time-of-day
new file mode 120000
index 0000000000..618c74f20f
--- /dev/null
+++ b/Lang/Ruby/Averages-Mean-time-of-day
@@ -0,0 +1 @@
+../../Task/Averages-Mean-time-of-day/Ruby
\ No newline at end of file
diff --git a/Lang/Ruby/Element-wise-operations b/Lang/Ruby/Element-wise-operations
new file mode 120000
index 0000000000..3bcda8c276
--- /dev/null
+++ b/Lang/Ruby/Element-wise-operations
@@ -0,0 +1 @@
+../../Task/Element-wise-operations/Ruby
\ No newline at end of file
diff --git a/Lang/Ruby/Permutations-by-swapping b/Lang/Ruby/Permutations-by-swapping
new file mode 120000
index 0000000000..38c3533897
--- /dev/null
+++ b/Lang/Ruby/Permutations-by-swapping
@@ -0,0 +1 @@
+../../Task/Permutations-by-swapping/Ruby
\ No newline at end of file
diff --git a/Lang/Ruby/Variable-size-Get b/Lang/Ruby/Variable-size-Get
new file mode 120000
index 0000000000..5b66b05e76
--- /dev/null
+++ b/Lang/Ruby/Variable-size-Get
@@ -0,0 +1 @@
+../../Task/Variable-size-Get/Ruby
\ No newline at end of file
diff --git a/Lang/Ruby/Write-language-name-in-3D-ASCII b/Lang/Ruby/Write-language-name-in-3D-ASCII
new file mode 120000
index 0000000000..fb2d331d26
--- /dev/null
+++ b/Lang/Ruby/Write-language-name-in-3D-ASCII
@@ -0,0 +1 @@
+../../Task/Write-language-name-in-3D-ASCII/Ruby
\ No newline at end of file
diff --git a/Lang/Rust/A+B b/Lang/Rust/A+B
new file mode 120000
index 0000000000..2fb1513469
--- /dev/null
+++ b/Lang/Rust/A+B
@@ -0,0 +1 @@
+../../Task/A+B/Rust
\ No newline at end of file
diff --git a/Lang/Rust/Ackermann-function b/Lang/Rust/Ackermann-function
new file mode 120000
index 0000000000..8e61ac4e80
--- /dev/null
+++ b/Lang/Rust/Ackermann-function
@@ -0,0 +1 @@
+../../Task/Ackermann-function/Rust
\ No newline at end of file
diff --git a/Lang/Rust/Anagrams b/Lang/Rust/Anagrams
new file mode 120000
index 0000000000..e58dffb584
--- /dev/null
+++ b/Lang/Rust/Anagrams
@@ -0,0 +1 @@
+../../Task/Anagrams/Rust
\ No newline at end of file
diff --git a/Lang/Rust/Arithmetic-Complex b/Lang/Rust/Arithmetic-Complex
new file mode 120000
index 0000000000..c777b6ff14
--- /dev/null
+++ b/Lang/Rust/Arithmetic-Complex
@@ -0,0 +1 @@
+../../Task/Arithmetic-Complex/Rust
\ No newline at end of file
diff --git a/Lang/Rust/Binary-search b/Lang/Rust/Binary-search
new file mode 120000
index 0000000000..d54c2fa018
--- /dev/null
+++ b/Lang/Rust/Binary-search
@@ -0,0 +1 @@
+../../Task/Binary-search/Rust
\ No newline at end of file
diff --git a/Lang/Rust/Bulls-and-cows b/Lang/Rust/Bulls-and-cows
new file mode 120000
index 0000000000..9a0a5c4ded
--- /dev/null
+++ b/Lang/Rust/Bulls-and-cows
@@ -0,0 +1 @@
+../../Task/Bulls-and-cows/Rust
\ No newline at end of file
diff --git a/Lang/Rust/Combinations b/Lang/Rust/Combinations
new file mode 120000
index 0000000000..09d8f29634
--- /dev/null
+++ b/Lang/Rust/Combinations
@@ -0,0 +1 @@
+../../Task/Combinations/Rust
\ No newline at end of file
diff --git a/Lang/Rust/Concurrent-computing b/Lang/Rust/Concurrent-computing
new file mode 120000
index 0000000000..e57cd2e79b
--- /dev/null
+++ b/Lang/Rust/Concurrent-computing
@@ -0,0 +1 @@
+../../Task/Concurrent-computing/Rust
\ No newline at end of file
diff --git a/Lang/Rust/Entropy b/Lang/Rust/Entropy
new file mode 120000
index 0000000000..99a057efce
--- /dev/null
+++ b/Lang/Rust/Entropy
@@ -0,0 +1 @@
+../../Task/Entropy/Rust
\ No newline at end of file
diff --git a/Lang/Rust/Enumerations b/Lang/Rust/Enumerations
new file mode 120000
index 0000000000..2b0f199c28
--- /dev/null
+++ b/Lang/Rust/Enumerations
@@ -0,0 +1 @@
+../../Task/Enumerations/Rust
\ No newline at end of file
diff --git a/Lang/Rust/Factorial b/Lang/Rust/Factorial
new file mode 120000
index 0000000000..e49f5c2e08
--- /dev/null
+++ b/Lang/Rust/Factorial
@@ -0,0 +1 @@
+../../Task/Factorial/Rust
\ No newline at end of file
diff --git a/Lang/Rust/Fibonacci-n-step-number-sequences b/Lang/Rust/Fibonacci-n-step-number-sequences
new file mode 120000
index 0000000000..b0f61180ce
--- /dev/null
+++ b/Lang/Rust/Fibonacci-n-step-number-sequences
@@ -0,0 +1 @@
+../../Task/Fibonacci-n-step-number-sequences/Rust
\ No newline at end of file
diff --git a/Lang/Rust/File-size b/Lang/Rust/File-size
new file mode 120000
index 0000000000..e0cc7dc7b3
--- /dev/null
+++ b/Lang/Rust/File-size
@@ -0,0 +1 @@
+../../Task/File-size/Rust
\ No newline at end of file
diff --git a/Lang/Rust/Gray-code b/Lang/Rust/Gray-code
new file mode 120000
index 0000000000..cfe3364eea
--- /dev/null
+++ b/Lang/Rust/Gray-code
@@ -0,0 +1 @@
+../../Task/Gray-code/Rust
\ No newline at end of file
diff --git a/Lang/Rust/Guess-the-number-With-feedback b/Lang/Rust/Guess-the-number-With-feedback
new file mode 120000
index 0000000000..d160e2b24e
--- /dev/null
+++ b/Lang/Rust/Guess-the-number-With-feedback
@@ -0,0 +1 @@
+../../Task/Guess-the-number-With-feedback/Rust
\ No newline at end of file
diff --git a/Lang/Rust/Loops-Break b/Lang/Rust/Loops-Break
new file mode 120000
index 0000000000..d2f052fce1
--- /dev/null
+++ b/Lang/Rust/Loops-Break
@@ -0,0 +1 @@
+../../Task/Loops-Break/Rust
\ No newline at end of file
diff --git a/Lang/Rust/Loops-Continue b/Lang/Rust/Loops-Continue
new file mode 120000
index 0000000000..ee7166cdf7
--- /dev/null
+++ b/Lang/Rust/Loops-Continue
@@ -0,0 +1 @@
+../../Task/Loops-Continue/Rust
\ No newline at end of file
diff --git a/Lang/Rust/Loops-For-with-a-specified-step b/Lang/Rust/Loops-For-with-a-specified-step
new file mode 120000
index 0000000000..b97701fd00
--- /dev/null
+++ b/Lang/Rust/Loops-For-with-a-specified-step
@@ -0,0 +1 @@
+../../Task/Loops-For-with-a-specified-step/Rust
\ No newline at end of file
diff --git a/Lang/Rust/Mutual-recursion b/Lang/Rust/Mutual-recursion
new file mode 120000
index 0000000000..efa9378565
--- /dev/null
+++ b/Lang/Rust/Mutual-recursion
@@ -0,0 +1 @@
+../../Task/Mutual-recursion/Rust
\ No newline at end of file
diff --git a/Lang/Rust/N-queens-problem b/Lang/Rust/N-queens-problem
new file mode 120000
index 0000000000..a56aa76327
--- /dev/null
+++ b/Lang/Rust/N-queens-problem
@@ -0,0 +1 @@
+../../Task/N-queens-problem/Rust
\ No newline at end of file
diff --git a/Lang/Rust/Random-numbers b/Lang/Rust/Random-numbers
new file mode 120000
index 0000000000..e261891398
--- /dev/null
+++ b/Lang/Rust/Random-numbers
@@ -0,0 +1 @@
+../../Task/Random-numbers/Rust
\ No newline at end of file
diff --git a/Lang/Rust/Read-entire-file b/Lang/Rust/Read-entire-file
new file mode 120000
index 0000000000..27a50e670c
--- /dev/null
+++ b/Lang/Rust/Read-entire-file
@@ -0,0 +1 @@
+../../Task/Read-entire-file/Rust
\ No newline at end of file
diff --git a/Lang/Rust/Roman-numerals-Decode b/Lang/Rust/Roman-numerals-Decode
new file mode 120000
index 0000000000..69dccfd9f9
--- /dev/null
+++ b/Lang/Rust/Roman-numerals-Decode
@@ -0,0 +1 @@
+../../Task/Roman-numerals-Decode/Rust
\ No newline at end of file
diff --git a/Lang/Rust/Roman-numerals-Encode b/Lang/Rust/Roman-numerals-Encode
new file mode 120000
index 0000000000..16e99f09c9
--- /dev/null
+++ b/Lang/Rust/Roman-numerals-Encode
@@ -0,0 +1 @@
+../../Task/Roman-numerals-Encode/Rust
\ No newline at end of file
diff --git a/Lang/Rust/Rot-13 b/Lang/Rust/Rot-13
new file mode 120000
index 0000000000..8ed87978e0
--- /dev/null
+++ b/Lang/Rust/Rot-13
@@ -0,0 +1 @@
+../../Task/Rot-13/Rust
\ No newline at end of file
diff --git a/Lang/Rust/Sorting-algorithms-Insertion-sort b/Lang/Rust/Sorting-algorithms-Insertion-sort
new file mode 120000
index 0000000000..886e502049
--- /dev/null
+++ b/Lang/Rust/Sorting-algorithms-Insertion-sort
@@ -0,0 +1 @@
+../../Task/Sorting-algorithms-Insertion-sort/Rust
\ No newline at end of file
diff --git a/Lang/Rust/String-case b/Lang/Rust/String-case
new file mode 120000
index 0000000000..9874a6e2a1
--- /dev/null
+++ b/Lang/Rust/String-case
@@ -0,0 +1 @@
+../../Task/String-case/Rust
\ No newline at end of file
diff --git a/Lang/Rust/Sum-and-product-of-an-array b/Lang/Rust/Sum-and-product-of-an-array
new file mode 120000
index 0000000000..79ce607e8d
--- /dev/null
+++ b/Lang/Rust/Sum-and-product-of-an-array
@@ -0,0 +1 @@
+../../Task/Sum-and-product-of-an-array/Rust
\ No newline at end of file
diff --git a/Lang/SIMPOL/00DESCRIPTION b/Lang/SIMPOL/00DESCRIPTION
index d835d3adcd..d007a14e4f 100644
--- a/Lang/SIMPOL/00DESCRIPTION
+++ b/Lang/SIMPOL/00DESCRIPTION
@@ -12,5 +12,4 @@ The language itself has a very small keyword set and a small set of operators. I
There are some interesting quirks in the language, especially with the operators. For example, strings can be not only added (concatenated), they can be used with the the unary minus, subtraction, and multiplication operators.
-Programs are developed and debugged using a Windows-based IDE and a set of RAD tools for creating databases and forms. Resulting programs are compiled to a cross-platform byte code that is executed using the SIMPOL runtime environment.
-{{language}}{{stub}}
\ No newline at end of file
+Programs are developed and debugged using a Windows-based IDE and a set of RAD tools for creating databases and forms. Resulting programs are compiled to a cross-platform byte code that is executed using the SIMPOL runtime environment.
\ No newline at end of file
diff --git a/Lang/SQL/00DESCRIPTION b/Lang/SQL/00DESCRIPTION
index 04c508ad95..8a74fbabbb 100644
--- a/Lang/SQL/00DESCRIPTION
+++ b/Lang/SQL/00DESCRIPTION
@@ -1,8 +1,12 @@
{{stub}}
{{language|SQL|bnf=http://savage.net.au/SQL/sql-2003-2.bnf.html}}
-{{Language programming paradigm|Query}}
+{{Language programming paradigm|Declarative}}
-'''[[wp:SQL|Structured Query Language]]''' (SQL) is the ''lingua franca'' for modifying and performing queries in database systems based on Dr. Edgar F. Codd's relational model. (Dr. Codd did not create the SQL language itself.)
+'''[[wp:SQL|Structured Query Language]]''' (SQL) is the ''lingua franca'' for modifying and performing queries in database systems based on Dr. Edgar F. Codd's relational model. (Dr. Codd did not create the SQL language itself.)
+
+SQL has come a long way and it does carry its 30-year-old legacy. But with legacy comes traction and robustness, and up to date, SQL has been the unchallenged means of querying and interoperating with RDBMS.
+
+Some non-RDBMS have even started to adopt SQL-esque languages as their querying interfaces because of the simplicity and expressiveness of SQL.
It is mostly declarative, but each database vendor has extended their dialect of SQL in various incompatible ways to give it more power or to simplify their implementation.
diff --git a/Lang/SQL/Top-rank-per-group b/Lang/SQL/Top-rank-per-group
new file mode 120000
index 0000000000..b9db7a52d6
--- /dev/null
+++ b/Lang/SQL/Top-rank-per-group
@@ -0,0 +1 @@
+../../Task/Top-rank-per-group/SQL
\ No newline at end of file
diff --git a/Lang/Scala/00DESCRIPTION b/Lang/Scala/00DESCRIPTION
index ba9ce24e3c..ff27b4ec4b 100644
--- a/Lang/Scala/00DESCRIPTION
+++ b/Lang/Scala/00DESCRIPTION
@@ -9,8 +9,8 @@
|bnf=http://www.scala-lang.org/docu/files/ScalaReference.pdf}}
{{language programming paradigm|functional}}
{{language programming paradigm|object-oriented}}
-{{language programming paradigm|generic}}Scala is a hybrid [[functional programming|Functional]]/[[object-oriented|OO]] language developed by Martin Odersky and his team at [http://lamp.epfl.ch/ LAMP]. Scala compiles to [[runs on vm::Java Virtual Machine|JVM]] [[bytecode]], and can inter-operate with [[Java]] code. Running as a .Net [[Common Language Runtime]] application is also supported.
+{{language programming paradigm|generic}}Scala is a hybrid [[functional programming|Functional]]/[[object-oriented|OO]] language developed by Martin Odersky and his team at [http://lamp.epfl.ch/ LAMP]. Scala compiles to [[runs on vm::Java Virtual Machine|JVM]] [[bytecode]], and can inter-operate with [[Java]] code.
The language is most focused on the results of the program, therefor the [http://en.wikipedia.org/wiki/Considered_harmful considered harmful] technical computer oriented concepts like threads, semaphore, pointers, goto- and break statements to struggle with are not there. For parallel processing (that very simple can archived) these concept are present but not visible to the programmer.
-Lots of RC tasks addresses technical "features" of goto's, break, continue, side effects, pointers, type-casting, weak-typing and so on and are deliberate not Scala's cup of tea.
\ No newline at end of file
+Lots of RC tasks addresses technical "features" of goto's, break, continue, side effects, pointers, type-casting, weak-typing and so on and are deliberately not Scala's cup of tea.
\ No newline at end of file
diff --git a/Lang/Scala/Inheritance-Multiple b/Lang/Scala/Inheritance-Multiple
new file mode 120000
index 0000000000..34cda3763b
--- /dev/null
+++ b/Lang/Scala/Inheritance-Multiple
@@ -0,0 +1 @@
+../../Task/Inheritance-Multiple/Scala
\ No newline at end of file
diff --git a/Lang/Scheme/Caesar-cipher b/Lang/Scheme/Caesar-cipher
new file mode 120000
index 0000000000..5f8ab37830
--- /dev/null
+++ b/Lang/Scheme/Caesar-cipher
@@ -0,0 +1 @@
+../../Task/Caesar-cipher/Scheme
\ No newline at end of file
diff --git a/Lang/Scheme/Matrix-exponentiation-operator b/Lang/Scheme/Matrix-exponentiation-operator
new file mode 120000
index 0000000000..420ffb158e
--- /dev/null
+++ b/Lang/Scheme/Matrix-exponentiation-operator
@@ -0,0 +1 @@
+../../Task/Matrix-exponentiation-operator/Scheme
\ No newline at end of file
diff --git a/Lang/Scheme/Modular-exponentiation b/Lang/Scheme/Modular-exponentiation
new file mode 120000
index 0000000000..0757dcca79
--- /dev/null
+++ b/Lang/Scheme/Modular-exponentiation
@@ -0,0 +1 @@
+../../Task/Modular-exponentiation/Scheme
\ No newline at end of file
diff --git a/Lang/Scheme/String-comparison b/Lang/Scheme/String-comparison
new file mode 120000
index 0000000000..6f57b9549b
--- /dev/null
+++ b/Lang/Scheme/String-comparison
@@ -0,0 +1 @@
+../../Task/String-comparison/Scheme
\ No newline at end of file
diff --git a/Lang/Seed7/Permutation-test b/Lang/Seed7/Permutation-test
new file mode 120000
index 0000000000..3f85a7cefc
--- /dev/null
+++ b/Lang/Seed7/Permutation-test
@@ -0,0 +1 @@
+../../Task/Permutation-test/Seed7
\ No newline at end of file
diff --git a/Lang/Seed7/Sorting-algorithms-Cocktail-sort b/Lang/Seed7/Sorting-algorithms-Cocktail-sort
new file mode 120000
index 0000000000..13acddf6b2
--- /dev/null
+++ b/Lang/Seed7/Sorting-algorithms-Cocktail-sort
@@ -0,0 +1 @@
+../../Task/Sorting-algorithms-Cocktail-sort/Seed7
\ No newline at end of file
diff --git a/Lang/Smalltalk/Even-or-odd b/Lang/Smalltalk/Even-or-odd
new file mode 120000
index 0000000000..6c4b8a14ac
--- /dev/null
+++ b/Lang/Smalltalk/Even-or-odd
@@ -0,0 +1 @@
+../../Task/Even-or-odd/Smalltalk
\ No newline at end of file
diff --git a/Lang/Smalltalk/Factors-of-an-integer b/Lang/Smalltalk/Factors-of-an-integer
new file mode 120000
index 0000000000..feebe1938c
--- /dev/null
+++ b/Lang/Smalltalk/Factors-of-an-integer
@@ -0,0 +1 @@
+../../Task/Factors-of-an-integer/Smalltalk
\ No newline at end of file
diff --git a/Lang/Smalltalk/Find-limit-of-recursion b/Lang/Smalltalk/Find-limit-of-recursion
new file mode 120000
index 0000000000..5bdf139160
--- /dev/null
+++ b/Lang/Smalltalk/Find-limit-of-recursion
@@ -0,0 +1 @@
+../../Task/Find-limit-of-recursion/Smalltalk
\ No newline at end of file
diff --git a/Lang/Smalltalk/Fractal-tree b/Lang/Smalltalk/Fractal-tree
new file mode 120000
index 0000000000..e788208f86
--- /dev/null
+++ b/Lang/Smalltalk/Fractal-tree
@@ -0,0 +1 @@
+../../Task/Fractal-tree/Smalltalk
\ No newline at end of file
diff --git a/Lang/Soar/00DESCRIPTION b/Lang/Soar/00DESCRIPTION
index 68689371af..c389edd5aa 100644
--- a/Lang/Soar/00DESCRIPTION
+++ b/Lang/Soar/00DESCRIPTION
@@ -1,5 +1,6 @@
-This is the cognitive architecture created by created by John Laird, Allen Newell, and Paul Rosenbloom.
+{{language
+|site=http://sitemaker.umich.edu/soar/home
+}}
+This is the cognitive architecture created by John Laird, Allen Newell, and Paul Rosenbloom.
-The primary implementation is on google code: http://code.google.com/p/soar/
-
-{{language}}
\ No newline at end of file
+The primary implementation is on google code: http://code.google.com/p/soar/
\ No newline at end of file
diff --git a/Lang/Standard-ML/Combinations-with-repetitions b/Lang/Standard-ML/Combinations-with-repetitions
new file mode 120000
index 0000000000..5be383f349
--- /dev/null
+++ b/Lang/Standard-ML/Combinations-with-repetitions
@@ -0,0 +1 @@
+../../Task/Combinations-with-repetitions/Standard-ML
\ No newline at end of file
diff --git a/Lang/Standard-ML/Count-in-octal b/Lang/Standard-ML/Count-in-octal
new file mode 120000
index 0000000000..2e3f8d7fcc
--- /dev/null
+++ b/Lang/Standard-ML/Count-in-octal
@@ -0,0 +1 @@
+../../Task/Count-in-octal/Standard-ML
\ No newline at end of file
diff --git a/Lang/Standard-ML/Include-a-file b/Lang/Standard-ML/Include-a-file
new file mode 120000
index 0000000000..76b08ccbce
--- /dev/null
+++ b/Lang/Standard-ML/Include-a-file
@@ -0,0 +1 @@
+../../Task/Include-a-file/Standard-ML
\ No newline at end of file
diff --git a/Lang/Standard-ML/Luhn-test-of-credit-card-numbers b/Lang/Standard-ML/Luhn-test-of-credit-card-numbers
new file mode 120000
index 0000000000..5aaa0c9310
--- /dev/null
+++ b/Lang/Standard-ML/Luhn-test-of-credit-card-numbers
@@ -0,0 +1 @@
+../../Task/Luhn-test-of-credit-card-numbers/Standard-ML
\ No newline at end of file
diff --git a/Lang/Standard-ML/Substring-Top-and-tail b/Lang/Standard-ML/Substring-Top-and-tail
new file mode 120000
index 0000000000..ba9e9d2c6b
--- /dev/null
+++ b/Lang/Standard-ML/Substring-Top-and-tail
@@ -0,0 +1 @@
+../../Task/Substring-Top-and-tail/Standard-ML
\ No newline at end of file
diff --git a/Lang/TI-83-BASIC/Binary-search b/Lang/TI-83-BASIC/Binary-search
new file mode 120000
index 0000000000..378084a2c6
--- /dev/null
+++ b/Lang/TI-83-BASIC/Binary-search
@@ -0,0 +1 @@
+../../Task/Binary-search/TI-83-BASIC
\ No newline at end of file
diff --git a/Lang/TI-83-BASIC/Hello-world-Graphical b/Lang/TI-83-BASIC/Hello-world-Graphical
new file mode 120000
index 0000000000..275571cdfd
--- /dev/null
+++ b/Lang/TI-83-BASIC/Hello-world-Graphical
@@ -0,0 +1 @@
+../../Task/Hello-world-Graphical/TI-83-BASIC
\ No newline at end of file
diff --git a/Lang/TI-83-BASIC/Loops-For b/Lang/TI-83-BASIC/Loops-For
new file mode 120000
index 0000000000..06f21585d2
--- /dev/null
+++ b/Lang/TI-83-BASIC/Loops-For
@@ -0,0 +1 @@
+../../Task/Loops-For/TI-83-BASIC
\ No newline at end of file
diff --git a/Lang/TI-83-BASIC/Menu b/Lang/TI-83-BASIC/Menu
new file mode 120000
index 0000000000..2035d150a9
--- /dev/null
+++ b/Lang/TI-83-BASIC/Menu
@@ -0,0 +1 @@
+../../Task/Menu/TI-83-BASIC
\ No newline at end of file
diff --git a/Lang/TI-83-BASIC/Pascals-triangle b/Lang/TI-83-BASIC/Pascals-triangle
new file mode 120000
index 0000000000..50b3b28731
--- /dev/null
+++ b/Lang/TI-83-BASIC/Pascals-triangle
@@ -0,0 +1 @@
+../../Task/Pascals-triangle/TI-83-BASIC
\ No newline at end of file
diff --git a/Lang/TPP/00DESCRIPTION b/Lang/TPP/00DESCRIPTION
index 37a044d51b..3fced52348 100644
--- a/Lang/TPP/00DESCRIPTION
+++ b/Lang/TPP/00DESCRIPTION
@@ -1,4 +1,4 @@
{{stub}}{{language|tpp
-|site=http://http://www.ngolde.de/tpp.html}}
+|site=http://www.ngolde.de/tpp.html}}
This is the markup language used by Nico Golde's text presentation program.
\ No newline at end of file
diff --git a/Lang/TXR/00DESCRIPTION b/Lang/TXR/00DESCRIPTION
index c8b9192a97..e908b2ce73 100644
--- a/Lang/TXR/00DESCRIPTION
+++ b/Lang/TXR/00DESCRIPTION
@@ -1,168 +1,58 @@
-{{stub}}{{language
+{{language
|site=http://www.nongnu.org/txr/}}
TXR is a new language implemented in [[C]], running on POSIX platforms such as [[Linux]], [[Mac OS X]] and on Windows via [[Cygwin]] as well as more natively thanks to [[MinGW]].
+The Rosetta Code TXR solutions can be viewed in color, and all on one page with a convenient navigation pane [http://www.nongnu.org/txr/rosetta-solutions.html here].
+
TXR started as a language for "reversing here-documents": evaluating a template of text containing variables, plus useful pattern matching directives, against some body of text and binding pieces of the text which matches variables. The variable bindings were output in POSIX shell variable assignment syntax, allowing for shell code like
eval $(txr ...)
-TXR remains close to these roots: its main language is the pattern-based text extraction notation well suited for matching large regions of
-entire text documents.
+TXR remains close to these roots: its main language is the pattern-based text extraction notation well-suited for matching large regions of
+entire text documents. That language has become powerful enough to neatly parse grammars, while the tool developed a Lisp dialect to round out the functionality and increase its power.
-About the @ character: this serves as a multi-level escape in TXR. In the fundamental TXR syntax, which is literal text, this character is a signal which indicates that the object which follows is a variable or directive. Then inside a directive, the character indicates that the object which follows is a TXR Lisp expression to be evaluated as such, rather than according to the expression evaluation rules of the pattern language. (And it is possible for TXR Lisp code to give this character additional meanings, since inside TXR Lisp, the notation expands to Lisp syntax: @foo denotes (sys:var foo), and @(foo ...) denotes (sys:expr foo>). In any context which needs to separate meta-variables and meta-expressions from variables and expressions, this may come in handy.)
+=== What's with all that @ stuff? ===
-Thus, the source of a TXR query is literal text except for directives and variables preceded by the @ character.
+About the @ character: this serves as a multi-level escape in TXR. In the fundamental TXR syntax, which is literal text, this character is a signal which indicates that the object which follows is a variable or directive. Then inside a directive, the character indicates that the object which follows is a TXR Lisp expression to be evaluated as such, rather than according to the expression evaluation rules of the pattern language:
-In this pattern language, computation evolves by textual pattern matching with implicit backtracking. Non-pattern matching activities are embedded into a pattern matching paradigm. For instance, the line
+This is some literal text to be matched. +@# this is a comment in the pattern language. +This text matches and binds @variable. +@(bind y ;; this is the start of a directive in the TXR pattern language + @(> x 42) ;; this is an expression in TXR Lisp +) +Back to text.-
Four score and seven years ago,+In TXR Lisp, the
@ character has more "meta" piled on top of it: @foo denotes (sys:var foo), and @(foo ...) denotes (sys:expr foo>). In any context which needs to separate meta-variables and meta-expressions from variables and expressions, this may come in handy. It's used by the op operator for currying, for instance (op * @1 @1) returns a function of one argument which returns the square of that argument. The implementation of the operator looks for syntax like (sys:var 1) and replaces it with the arguments of the generated lambda function. The @ character also appears in quasiliteral strings, where it interpolates the values of variables and expressions as text.
-is a TXR directive which matches a line of that exact text, or else fails. The following is also a directive:
+TXR is somewhat unusual in that the relationship between a domain-specific language (DSL) and general-purpose host language is reversed. Typically, at least in Lisp systems, DSL's are embedded into the parent language. In TXR, the "outer shell" is the domain-specific language for extracting text, and Lisp is embedded in it as "computational appliance". It doesn't take much to reach the Lisp though: a TXR source file can just consist of a single @(do ...) directive which contains nothing but TXR Lisp forms. Also, TXR Lisp evaluation is available from program invocation via the -e and -p options.
-@(collect :vars (foo)). This is a Lisp expression with interior structure, but to the parser of the pattern language, it's also basically just a token, like a giant keyword. IT begins a collect clause, and is followed by some optional material which may just be literal text, and must be terminated by the @(end) directive: another token-expression entity.
-which succeeds if foo has no prior binding, or already contains "abc", but fails if foo has a binding to something other than "abc".
+=== Dual Personality ===
-The success of a directive means that computation proceeds to the next directive (and, if this is a pattern match, the input position advances). Failure means that the enclosing query fails, triggering back-tracking behaviors and possibly failure of the entire query.
+From the solutions below, it is obvious that some of them make heavy use of the pattern language and little or no TXR Lisp. Others are quite the other way around, based entirely or almost entirely on Lisp, whereas others follow strategies of mixing the approaches.
-A bizarre feature of TXR is that the directives like @(collect) are independent pieces of Lisp. But, they are also de-facto "tokens" in a block-structure language. For instance @(collect) starts a block, which must be terminated by @(end). Inside @(collect) there can be additional syntax, such as @(collect :gap 0 :vars (a b c)).
+=== Lisp Innovation ===
-==Extremely Simple Query==
+Although TXR Lisp is heavily based on prior work and strongly influenced by Common Lisp (for instance, there is a real nil symbol which is a list terminator and means "false", and it's primarily Lisp-2 dialect), TXR Lisp nevertheless manages to innovate within the world of Lisp.
-Extract first matching line from the password file. Of course, TXR matches are not restricted to single line!
+==== Can't We All Just Get Along? ====
--user="root" -pw="x" -uid="0" -gid="0" -gecos="root" -home="/root" -shell="/bin/bash"+One major innovation is the way in which TXR Lisp closes the ages-old gap between Lisp-1 and Lisp-2, and the associated religious sectarian division it has caused. TXR Lisp recognizes that there are advantages both in having separate function and variable namespaces, and in having a single namespace: and it provides support for both approaches. The idea is devilishly simple. A special operator called "dwim" (do what I mean) is provided such that
(dwim forms ...) basically denotes (forms ...), but with Lisp-1 style evaluation: any of the forms which are symbols are resolved according to a flattened namespace that combines variable and function bindings (with conflicts resolved in favor of variables). TXR Lisp programmers do not use the dwim operator directly, but rather the square bracket notation [a b c ...] -> (dwim a b c). So for instance, [mapcar list '(1 2 3) '(a b c)] zips together two lists. Using round brackets, it would have to be (mapcar (fun list) '(1 2 3) '(a b c)). Moreover, if foo is a variable that holds a function of one argument, it has to be called using (call foo arg). But with the "dwim brackets", it is just [foo arg]. The "dwim brackets" also support various funcall-extensions, like indexing into arrays and slicing and so on. If h is a hash then [h "a" 42] looks up the string a in the hash and returns the value, or else returns 42 if the key is not found. If a is an array, list or string, then [a 2..3] extracts a slice. On the other hand, "dwim brackets" do not support operators: [let (a b c) ...] is not valid; or rather, it expects a variable or function let to exist, ignoring the let operator. Operators are strictly in the Lisp-2 domain, which is fine because Lisp-2 is a cleaner model with regard to operators anyway!
-Now, pre-bind the user variable first to retrieve some other user. Now @(skip) kicks into action, skipping non-matching material:
+==== Polymorphizing the Classics ====
-user="sshd" -pw="x" -uid="114" -gid="65534" -gecos="" -home="/var/run/sshd" -shell="/usr/sbin/nologin"+In TXR Lisp, classic Lisp operations like
mapcar, cdr or append work exactly like they are supposed to, when they operate on lists. Right down to improper lists like (append 42) -> 42 and (append '(1) 2) -> (1 . 2).
+However, most of the operations have been extended to also work with strings and vectors. So for instance, (mapcar (op + 1) "abc") nicely yields the string "bcd" where 1 has been added to every character code of the original string. (car "abc") yields #\a, a character, (cdr "abc") yields "bc", and (cdr "c") yields nil (rather than the empty string!) (Almost) everything proceeds from there.
+==== Good Hackers Borrow; Great Ones Steal ====
-==Simple Query==
+TXR steals ideas from libraries and languages related to Lisp. The op operator is inspired by Goo's op, and the cl-op library for Common Lisp which is also inspired by Goo's op.
-Re-implement the "free" utility on Linux, showing an overview of memory use:
+Array and list slices are straight out of Python, right down to the half-open ranges (not including the upper endpoint), and negative values indexing from the tail of the array. The concept is further improved upon by allowing the Lisp symbols nil and t to be used as range indexes.
-x contains "abc" then (set [x 1..2] "foo") changes x to contain "afooc".
-Sample run:
-
-$ ./meminfo.txr - TOTAL USED FREE BUFFERS CACHED -Mem: 769280 647752 121528 160108 286844 -+/- buffers/cache: 200800 568480 -Swap: 1048568 18200 1030368 -- -== Complex Query == - -Here is a TXR query for computing the complete dependencies of a C source file (including system and compiler headers) on a typical GNU/Linux system, demonstrating features like parallel clauses, recursion and exception handling. - -
$ txr dep.txr match.c -match.o: /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h /usr/lib/gcc/i586-redhat-linux/4.4.1/include/stddef.h /usr/include/bits/types.h /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h /usr/lib/gcc/i586-redhat-linux/4.4.1/include/stdarg.h /usr/include/bits/wchar.h /usr/include/wctype.h /usr/include/endian.h /usr/include/bits/endian.h /usr/include/bits/byteswap.h /usr/include/xlocale.h /usr/include/bits/wchar2.h /usr/include/bits/wchar-ldbl.h /usr/include/gconv.h /usr/include/bits/stdio-lock.h /usr/include/bits/libc-lock.h /usr/include/pthread.h /usr/include/sched.h /usr/include/time.h /usr/include/bits/time.h /usr/include/bits/sched.h /usr/include/signal.h /usr/include/bits/signum.h /usr/include/bits/siginfo.h /usr/include/bits/sigaction.h /usr/include/bits/sigcontext.h /usr/include/asm/sigcontext.h /usr/include/linux/types.h /usr/include/linux/posix_types.h /usr/include/linux/stddef.h /usr/include/asm/posix_types.h /usr/include/asm/types.h /usr/include/asm-generic/int-ll64.h /usr/include/bits/sigstack.h /usr/include/sys/ucontext.h /usr/include/bits/pthreadtypes.h /usr/include/bits/sigthread.h /usr/include/bits/setjmp.h /usr/include/bits/libio-ldbl.h /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h /usr/include/getopt.h /usr/include/ctype.h /usr/include/bits/stdio.h /usr/include/bits/stdio2.h /usr/include/bits/stdio-ldbl.h /usr/include/stdlib.h /usr/include/bits/waitflags.h /usr/include/bits/waitstatus.h /usr/include/alloca.h /usr/include/bits/stdlib.h /usr/include/bits/stdlib-ldbl.h /usr/include/string.h /usr/include/bits/string.h /usr/include/bits/string2.h /usr/include/bits/string3.h /usr/include/assert.h /usr/include/errno.h /usr/include/bits/errno.h /usr/include/linux/errno.h /usr/include/asm/errno.h /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h /usr/include/dirent.h /usr/include/bits/dirent.h /usr/include/bits/posix1_lim.h /usr/include/bits/local_lim.h /usr/include/linux/limits.h /usr/include/setjmp.h config.h lib.h gc.h unwind.h regex.h /usr/include/limits.h /usr/lib/gcc/i586-redhat-linux/4.4.1/include/limits.h /usr/lib/gcc/i586-redhat-linux/4.4.1/include/syslimits.h /usr/include/bits/posix2_lim.h /usr/include/bits/xopen_lim.h stream.h parser.h txr.h utf8.h filter.h match.h\ No newline at end of file +The
group-by function is a straight rip-off from Ruby.
\ No newline at end of file
diff --git a/Lang/TXR/Ackermann-function b/Lang/TXR/Ackermann-function
new file mode 120000
index 0000000000..27c6cf6e75
--- /dev/null
+++ b/Lang/TXR/Ackermann-function
@@ -0,0 +1 @@
+../../Task/Ackermann-function/TXR
\ No newline at end of file
diff --git a/Lang/TXR/Combinations b/Lang/TXR/Combinations
new file mode 120000
index 0000000000..b0fe0ed4e2
--- /dev/null
+++ b/Lang/TXR/Combinations
@@ -0,0 +1 @@
+../../Task/Combinations/TXR
\ No newline at end of file
diff --git a/Lang/TXR/Evaluate-binomial-coefficients b/Lang/TXR/Evaluate-binomial-coefficients
new file mode 120000
index 0000000000..14e2db8275
--- /dev/null
+++ b/Lang/TXR/Evaluate-binomial-coefficients
@@ -0,0 +1 @@
+../../Task/Evaluate-binomial-coefficients/TXR
\ No newline at end of file
diff --git a/Lang/TXR/Factorial b/Lang/TXR/Factorial
new file mode 120000
index 0000000000..5f857ff698
--- /dev/null
+++ b/Lang/TXR/Factorial
@@ -0,0 +1 @@
+../../Task/Factorial/TXR
\ No newline at end of file
diff --git a/Lang/TXR/Find-limit-of-recursion b/Lang/TXR/Find-limit-of-recursion
new file mode 120000
index 0000000000..d8dac92486
--- /dev/null
+++ b/Lang/TXR/Find-limit-of-recursion
@@ -0,0 +1 @@
+../../Task/Find-limit-of-recursion/TXR
\ No newline at end of file
diff --git a/Lang/TXR/FizzBuzz b/Lang/TXR/FizzBuzz
new file mode 120000
index 0000000000..ff6d80d167
--- /dev/null
+++ b/Lang/TXR/FizzBuzz
@@ -0,0 +1 @@
+../../Task/FizzBuzz/TXR
\ No newline at end of file
diff --git a/Lang/TXR/Floyds-triangle b/Lang/TXR/Floyds-triangle
new file mode 120000
index 0000000000..61542aed42
--- /dev/null
+++ b/Lang/TXR/Floyds-triangle
@@ -0,0 +1 @@
+../../Task/Floyds-triangle/TXR
\ No newline at end of file
diff --git a/Lang/TXR/Mandelbrot-set b/Lang/TXR/Mandelbrot-set
new file mode 120000
index 0000000000..1ae4e514ac
--- /dev/null
+++ b/Lang/TXR/Mandelbrot-set
@@ -0,0 +1 @@
+../../Task/Mandelbrot-set/TXR
\ No newline at end of file
diff --git a/Lang/TXR/Maze-generation b/Lang/TXR/Maze-generation
new file mode 120000
index 0000000000..4a450764fb
--- /dev/null
+++ b/Lang/TXR/Maze-generation
@@ -0,0 +1 @@
+../../Task/Maze-generation/TXR
\ No newline at end of file
diff --git a/Lang/TXR/Metaprogramming b/Lang/TXR/Metaprogramming
new file mode 120000
index 0000000000..3442a1a098
--- /dev/null
+++ b/Lang/TXR/Metaprogramming
@@ -0,0 +1 @@
+../../Task/Metaprogramming/TXR
\ No newline at end of file
diff --git a/Lang/TXR/Parsing-RPN-to-infix-conversion b/Lang/TXR/Parsing-RPN-to-infix-conversion
new file mode 120000
index 0000000000..9cd8c57740
--- /dev/null
+++ b/Lang/TXR/Parsing-RPN-to-infix-conversion
@@ -0,0 +1 @@
+../../Task/Parsing-RPN-to-infix-conversion/TXR
\ No newline at end of file
diff --git a/Lang/TXR/Partial-function-application b/Lang/TXR/Partial-function-application
new file mode 120000
index 0000000000..07df5faf52
--- /dev/null
+++ b/Lang/TXR/Partial-function-application
@@ -0,0 +1 @@
+../../Task/Partial-function-application/TXR
\ No newline at end of file
diff --git a/Lang/TXR/Rename-a-file b/Lang/TXR/Rename-a-file
new file mode 120000
index 0000000000..e5a84e7a33
--- /dev/null
+++ b/Lang/TXR/Rename-a-file
@@ -0,0 +1 @@
+../../Task/Rename-a-file/TXR
\ No newline at end of file
diff --git a/Lang/TXR/Runtime-evaluation-In-an-environment b/Lang/TXR/Runtime-evaluation-In-an-environment
new file mode 120000
index 0000000000..ee43fac6a0
--- /dev/null
+++ b/Lang/TXR/Runtime-evaluation-In-an-environment
@@ -0,0 +1 @@
+../../Task/Runtime-evaluation-In-an-environment/TXR
\ No newline at end of file
diff --git a/Lang/TXR/Set-consolidation b/Lang/TXR/Set-consolidation
new file mode 120000
index 0000000000..55d41491f9
--- /dev/null
+++ b/Lang/TXR/Set-consolidation
@@ -0,0 +1 @@
+../../Task/Set-consolidation/TXR
\ No newline at end of file
diff --git a/Lang/TXR/Top-rank-per-group b/Lang/TXR/Top-rank-per-group
new file mode 120000
index 0000000000..06141ce708
--- /dev/null
+++ b/Lang/TXR/Top-rank-per-group
@@ -0,0 +1 @@
+../../Task/Top-rank-per-group/TXR
\ No newline at end of file
diff --git a/Lang/TXR/Twelve-statements b/Lang/TXR/Twelve-statements
new file mode 120000
index 0000000000..066ff5f5d4
--- /dev/null
+++ b/Lang/TXR/Twelve-statements
@@ -0,0 +1 @@
+../../Task/Twelve-statements/TXR
\ No newline at end of file
diff --git a/Lang/TXR/Y-combinator b/Lang/TXR/Y-combinator
new file mode 120000
index 0000000000..e276d88fd0
--- /dev/null
+++ b/Lang/TXR/Y-combinator
@@ -0,0 +1 @@
+../../Task/Y-combinator/TXR
\ No newline at end of file
diff --git a/Lang/True-BASIC/00DESCRIPTION b/Lang/True-BASIC/00DESCRIPTION
index 4d3d27c049..5e988b9b09 100644
--- a/Lang/True-BASIC/00DESCRIPTION
+++ b/Lang/True-BASIC/00DESCRIPTION
@@ -1 +1,3 @@
-{{stub}}{{language}}
\ No newline at end of file
+{{stub}}
+{{language
+|site=http://www.truebasic.com/}}
\ No newline at end of file
diff --git a/Lang/UBASIC/00DESCRIPTION b/Lang/UBASIC/00DESCRIPTION
index 24309cb390..a41ca548e4 100644
--- a/Lang/UBASIC/00DESCRIPTION
+++ b/Lang/UBASIC/00DESCRIPTION
@@ -1,6 +1,4 @@
-{{stub}}{{language}}
-
-UBASIC is a freeware BASIC interpreter written by Yuji Kida at Rikkyo University in Japan, specialized for mathematical computing.
+{{implementation|BASIC}}'''UBASIC''' is a freeware BASIC interpreter written by Yuji Kida at Rikkyo University in Japan, specialized for mathematical computing.
More information and links can be found at its [[wp:UBASIC|Wikipedia article]].
==Sample Program==
diff --git a/Lang/Vim-Script/00DESCRIPTION b/Lang/Vim-Script/00DESCRIPTION
index ab1fd757bc..28977a85b4 100644
--- a/Lang/Vim-Script/00DESCRIPTION
+++ b/Lang/Vim-Script/00DESCRIPTION
@@ -1,10 +1,9 @@
-Vim Script is the language for editing the popular [http://www.vim.org/ Vim text editor]. It is also sometimes called VimL. It is the 13th most popular language on [https://github.com/languages/VimL GitHub].
-{{unimpl_Page|Vim_Script}}
+{{stub}}
+{{language}}
+Vim Script is the language for editing the popular [http://www.vim.org/ Vim text editor]. It is also sometimes called VimL.
== External Links ==
-* [http://www.vim.org Vim.org] - Official Site]
+* [http://www.vim.org vim.org] - official site
* [http://www.vim.org/scripts/ Vim's script repository]
-* [http://vimdoc.sourceforge.net/htmldoc/usr_41.html "Write a Vim Script", intro to Vim Script in the Vim documentation]
-* [http://learnvimscriptthehardway.stevelosh.com/ Learn Vimscript the Hard Way] - an online book for learning Vim Script]
-
-{{stub}}{{language}}
\ No newline at end of file
+* [http://vimdoc.sourceforge.net/htmldoc/usr_41.html "Write a Vim Script"] - intro to Vim Script in the Vim documentation
+* [http://learnvimscriptthehardway.stevelosh.com/ Learn Vimscript the Hard Way] - an online book for learning Vim Script
\ No newline at end of file
diff --git a/Lang/Vim-Script/Remove-duplicate-elements b/Lang/Vim-Script/Remove-duplicate-elements
new file mode 120000
index 0000000000..206f655844
--- /dev/null
+++ b/Lang/Vim-Script/Remove-duplicate-elements
@@ -0,0 +1 @@
+../../Task/Remove-duplicate-elements/Vim-Script
\ No newline at end of file
diff --git a/Lang/Visual-Objects/00DESCRIPTION b/Lang/Visual-Objects/00DESCRIPTION
index b96402f30a..a8c663e13f 100644
--- a/Lang/Visual-Objects/00DESCRIPTION
+++ b/Lang/Visual-Objects/00DESCRIPTION
@@ -1,8 +1,6 @@
-{{
-language|Visual Objects
+{{stub}}
+{{language|Visual Objects
|site=http://www.cavo.com/
-LST=no
}}
{{Wikipedia}}
-Visual Objects is an object-oriented computer programming language that is used to create software programs that operate primarily under Windows. Although it can be used as a general-purpose programming tool, it is almost exclusively used to create database programs.
-{{stub}}
\ No newline at end of file
+Visual Objects is an object-oriented computer programming language that is used to create software programs that operate primarily under Windows. Although it can be used as a general-purpose programming tool, it is almost exclusively used to create database programs.
\ No newline at end of file
diff --git a/Lang/Visual-Prolog/00DESCRIPTION b/Lang/Visual-Prolog/00DESCRIPTION
index e81fe26b3a..185adf11ec 100644
--- a/Lang/Visual-Prolog/00DESCRIPTION
+++ b/Lang/Visual-Prolog/00DESCRIPTION
@@ -1,20 +1,20 @@
+{{language
+|exec=machine
+|gc=yes
+|parampass=value
+|checking=static
+|safety=safe
+|strength=strong
+|express=partially implicit
+|site=http://www.visual-prolog.com/}}
Visual Prolog is a multi-paradigm language with origin in Prolog.
See also
* [[wp:Visual Prolog|Visual Prolog]] in Wikipedia
-* [http://www.visual-prolog.com Visual Prolog home page]
* [http://wiki.visual-prolog.com Visual Prolog wiki]
-[[Category:Programming Languages]]
-[[Category:Execution method/Compiled/Machine code]]
-[[Category:Garbage collection/Yes]]
-[[Category:Parameter passing/By value]]
[[Category:Programming paradigm/Functional]]
[[Category:Programming paradigm/Generic]]
[[Category:Programming paradigm/Imperative]]
[[Category:Programming paradigm/Logic Programming]]
-[[Category:Programming paradigm/Object-oriented]]
-[[Category:Typing/Checking/Static]]
-[[Category:Typing/Expression/Partially implicit]]
-[[Category:Typing/Safe]]
-[[Category:Typing/Strong]]
\ No newline at end of file
+[[Category:Programming paradigm/Object-oriented]]
\ No newline at end of file
diff --git a/Lang/Wrapl/00DESCRIPTION b/Lang/Wrapl/00DESCRIPTION
index 1f5ef4cd1f..41d53f3778 100644
--- a/Lang/Wrapl/00DESCRIPTION
+++ b/Lang/Wrapl/00DESCRIPTION
@@ -1,5 +1,5 @@
{{language|Wrapl
-site=http://wrapl.sourceforge.net/
+|site=http://wrapl.sourceforge.net/
|exec=interpreted
|parampass=reference
|LCT=no
diff --git a/Lang/XQuery/Y-combinator b/Lang/XQuery/Y-combinator
new file mode 120000
index 0000000000..34893f9e8f
--- /dev/null
+++ b/Lang/XQuery/Y-combinator
@@ -0,0 +1 @@
+../../Task/Y-combinator/XQuery
\ No newline at end of file
diff --git a/Lang/Yacas/00DESCRIPTION b/Lang/Yacas/00DESCRIPTION
index aebceeee0e..026997bb17 100644
--- a/Lang/Yacas/00DESCRIPTION
+++ b/Lang/Yacas/00DESCRIPTION
@@ -1,10 +1,10 @@
-{{stub}}{{language|Yacas
+{{stub}}
+{{language|Yacas
+|site=http://yacas.sourceforge.net/
|exec=interpreted
|LCT=no
}}
-
YACAS (Yet Another Computer Algebra System) is an easy to use, general purpose Computer Algebra System, a program for symbolic manipulation of mathematical expressions. It uses its own programming language designed for symbolic as well as arbitrary-precision numerical computations. The system has a library of scripts that implement many of the symbolic algebra operations; new algorithms can be easily added to the library. YACAS comes with extensive documentation (hundreds of pages) covering the scripting language, the functionality that is already implemented in the system, and the algorithms used.
-
== See Also ==
*[[wp:Yacas|Wikipedia : Yacas]]
\ No newline at end of file
diff --git a/Task/100-doors/6502-Assembly/100-doors-1.6502 b/Task/100-doors/6502-Assembly/100-doors-1.6502
new file mode 100644
index 0000000000..52e1ffea77
--- /dev/null
+++ b/Task/100-doors/6502-Assembly/100-doors-1.6502
@@ -0,0 +1,48 @@
+; 100 DOORS in 6502 assembly language for: http://www.6502asm.com/beta/index.html
+; Written for the original MOS Technology, Inc. NMOS version of the 6502, but should work with any version.
+; Based on BASIC QB64 unoptimized version: http://rosettacode.org/wiki/100_doors#BASIC
+;
+; Notes:
+; Doors array[1..100] is at $0201..$0264. On the specified emulator, this is in video memory, so tbe results will
+; be directly shown as pixels in the display.
+; $0200 (door 0) is cleared for display purposes but is not involved in the open/close loops.
+; Y register holds Stride
+; X register holds Index
+; Zero Page address $01 used to add Stride to Index (via A) because there's no add-to-X or add-Y-to-A instruction.
+
+ ; First, zero door array
+ LDA #00
+ LDX #100
+Z_LOOP:
+ STA 200,X
+ DEX
+ BNE Z_LOOP
+ STA 200,X
+
+ ; Now do doors repeated open/close
+ LDY #01 ; Initial value of Stride
+S_LOOP:
+ CPY #101
+ BCS S_DONE
+ TYA ; Initial value of Index
+I_LOOP:
+ CMP #101
+ BCS I_DONE
+ TAX ; Use as Door array index
+ INC $200,X ; Toggle bit 0 to reverse state of door
+ STY 01 ; Add stride (Y) to index (X, via A)
+ ADC 01
+ BCC I_LOOP
+I_DONE:
+ INY
+ BNE S_LOOP
+S_DONE:
+
+ ; Finally, format array values for output: 0 for closed, 1 for open
+ LDX #100
+C_LOOP:
+ LDA $200,X
+ AND #$01
+ STA $200,X
+ DEX
+ BNE C_LOOP
diff --git a/Task/100-doors/6502-Assembly/100-doors-2.6502 b/Task/100-doors/6502-Assembly/100-doors-2.6502
new file mode 100644
index 0000000000..a9d3f84362
--- /dev/null
+++ b/Task/100-doors/6502-Assembly/100-doors-2.6502
@@ -0,0 +1,17 @@
+ ;assumes memory at $02xx is initially set to 0 and stack pointer is initialized
+ ;the 1 to 100 door byte array will be at $0200-$0263 (decimal 512 to 611)
+ ;Zero-page location $01 will hold delta
+ ;At end, closed doors = $00, open doors = $01
+
+start: ldx #0 ;initialize index - first door will be at $200 + $0
+ stx $1
+ inc $1 ;start out with a delta of 1 (0+1=1)
+openloop: inc $200,X ;open X'th door
+ inc $1 ;add 2 to delta
+ inc $1
+ txa ;add delta to X by transferring X to A, adding delta to A, then transferring back to X
+ clc ; clear carry before adding (6502 has no add-without-carry instruction)
+ adc $1
+ tax
+ cpx #$64 ;check to see if we're at or past the 100th door (at $200 + $63)
+ bmi openloop ;jump back to openloop if less than 100
diff --git a/Task/100-doors/6502-Assembly/100-doors.6502 b/Task/100-doors/6502-Assembly/100-doors.6502
deleted file mode 100644
index 0a02bc7b81..0000000000
--- a/Task/100-doors/6502-Assembly/100-doors.6502
+++ /dev/null
@@ -1,10 +0,0 @@
- ;assume all memory is initially set to 0
- inc $1 ;start out with a delta of 1
-openloop: inc $200,X ;open a door at X
- inc $1 ;add 2 to delta
- inc $1
- txa ;add delta to X
- adc $1
- tax
- cpx #$65 ;check to see if we're at the 100th door
- bmi openloop ;jump back to openloop if less than 100
diff --git a/Task/100-doors/BASIC/100-doors-1.basic b/Task/100-doors/BASIC/100-doors-1.basic
index f2179f24e0..dd92311c2f 100644
--- a/Task/100-doors/BASIC/100-doors-1.basic
+++ b/Task/100-doors/BASIC/100-doors-1.basic
@@ -1,16 +1,22 @@
-DIM doors(0 TO 99)
-FOR pass = 0 TO 99
- FOR door = pass TO 99 STEP pass + 1
- PRINT doors(door)
- PRINT NOT doors(door)
- doors(door) = NOT doors(door)
- NEXT door
-NEXT pass
-FOR i = 0 TO 99
- PRINT "Door #"; i + 1; " is ";
- IF NOT doors(i) THEN
- PRINT "closed"
- ELSE
- PRINT "open"
- END IF
-NEXT i
+REM "100 Doors" program for QB64 BASIC (http://www.qb64.net/), a QuickBASIC-like compiler.
+REM Author: G. A. Tippery
+REM Date: 12-Feb-2014
+REM
+REM Unoptimized (naive) version, per specifications at http://rosettacode.org/wiki/100_doors
+
+DEFINT A-Z
+CONST N = 100
+DIM door(N)
+
+FOR stride = 1 TO N
+ FOR index = stride TO N STEP stride
+ LET door(index) = NOT (door(index))
+ NEXT index
+NEXT stride
+
+PRINT "Open doors:"
+FOR index = 1 TO N
+ IF door(index) THEN PRINT index
+NEXT index
+
+END
diff --git a/Task/100-doors/BASIC/100-doors-2.basic b/Task/100-doors/BASIC/100-doors-2.basic
index ddaffaa2c1..f2179f24e0 100644
--- a/Task/100-doors/BASIC/100-doors-2.basic
+++ b/Task/100-doors/BASIC/100-doors-2.basic
@@ -1,7 +1,11 @@
DIM doors(0 TO 99)
-FOR door = 0 TO 99
- IF INT(SQR(door)) = SQR(door) THEN doors(door) = -1
-NEXT door
+FOR pass = 0 TO 99
+ FOR door = pass TO 99 STEP pass + 1
+ PRINT doors(door)
+ PRINT NOT doors(door)
+ doors(door) = NOT doors(door)
+ NEXT door
+NEXT pass
FOR i = 0 TO 99
PRINT "Door #"; i + 1; " is ";
IF NOT doors(i) THEN
diff --git a/Task/100-doors/BASIC/100-doors-3.basic b/Task/100-doors/BASIC/100-doors-3.basic
index 14a02c2b80..ddaffaa2c1 100644
--- a/Task/100-doors/BASIC/100-doors-3.basic
+++ b/Task/100-doors/BASIC/100-doors-3.basic
@@ -1,10 +1,12 @@
-'lrcvs 04.11.12
-cls
-x = 1 : y = 3 : z = 0
-print x + " Open"
-do
-z = x + y
-print z + " Open"
-x = z : y = y + 2
-until z >= 100
-end
+DIM doors(0 TO 99)
+FOR door = 0 TO 99
+ IF INT(SQR(door)) = SQR(door) THEN doors(door) = -1
+NEXT door
+FOR i = 0 TO 99
+ PRINT "Door #"; i + 1; " is ";
+ IF NOT doors(i) THEN
+ PRINT "closed"
+ ELSE
+ PRINT "open"
+ END IF
+NEXT i
diff --git a/Task/100-doors/BASIC/100-doors-4.basic b/Task/100-doors/BASIC/100-doors-4.basic
new file mode 100644
index 0000000000..14a02c2b80
--- /dev/null
+++ b/Task/100-doors/BASIC/100-doors-4.basic
@@ -0,0 +1,10 @@
+'lrcvs 04.11.12
+cls
+x = 1 : y = 3 : z = 0
+print x + " Open"
+do
+z = x + y
+print z + " Open"
+x = z : y = y + 2
+until z >= 100
+end
diff --git a/Task/100-doors/Coq/100-doors-1.coq b/Task/100-doors/Coq/100-doors-1.coq
new file mode 100644
index 0000000000..716e97ea68
--- /dev/null
+++ b/Task/100-doors/Coq/100-doors-1.coq
@@ -0,0 +1,26 @@
+Require Import List.
+
+Fixpoint rep {A} (a : A) n :=
+ match n with
+ | O => nil
+ | S n' => a::(rep a n')
+ end.
+
+Fixpoint flip (l : list bool) (n k : nat) : list bool :=
+ match l with
+ | nil => nil
+ | cons h t => match k with
+ | O => (negb h) :: (flip t n n)
+ | S k' => h :: (flip t n k')
+ end
+ end.
+
+Definition flipeach l n := flip l n n.
+
+Fixpoint flipwhile l n :=
+ match n with
+ | O => flipeach l 0
+ | S n' => flipwhile (flipeach l (S n')) n'
+ end.
+
+Definition prison cells := flipwhile (rep false (S cells)) cells.
diff --git a/Task/100-doors/Coq/100-doors-2.coq b/Task/100-doors/Coq/100-doors-2.coq
new file mode 100644
index 0000000000..b22b7e0c51
--- /dev/null
+++ b/Task/100-doors/Coq/100-doors-2.coq
@@ -0,0 +1,13 @@
+Require Import List.
+
+Fixpoint prisoo' nd n k accu :=
+ match nd with
+ | O => rev accu
+ | S nd' => let ra := match k with
+ | O => (true, S n, (n + n))
+ | S k' => (false, n, k')
+ end in
+ prisoo' nd' (snd (fst ra)) (snd ra) ((fst (fst ra))::accu)
+ end.
+
+Definition prisoo n := prisoo' (S n) 1 0 nil.
diff --git a/Task/100-doors/Coq/100-doors-3.coq b/Task/100-doors/Coq/100-doors-3.coq
new file mode 100644
index 0000000000..56df2e7103
--- /dev/null
+++ b/Task/100-doors/Coq/100-doors-3.coq
@@ -0,0 +1 @@
+Goal prison 100 = prisoo 100. compute. reflexivity. Qed.
diff --git a/Task/100-doors/Coq/100-doors-4.coq b/Task/100-doors/Coq/100-doors-4.coq
new file mode 100644
index 0000000000..c469094c8e
--- /dev/null
+++ b/Task/100-doors/Coq/100-doors-4.coq
@@ -0,0 +1 @@
+Goal forall n, prison n = prisoo n. Abort.
diff --git a/Task/100-doors/Frink/100-doors.frink b/Task/100-doors/Frink/100-doors.frink
new file mode 100644
index 0000000000..7ba4aabad2
--- /dev/null
+++ b/Task/100-doors/Frink/100-doors.frink
@@ -0,0 +1,9 @@
+doors = new array[[101], false]
+for pass=1 to 100
+ for door=pass to 100 step pass
+ doors@door = ! doors@door
+
+print["Open doors: "]
+for door=1 to 100
+ if doors@door
+ print["$door "]
diff --git a/Task/100-doors/JavaScript/100-doors-1.js b/Task/100-doors/JavaScript/100-doors-1.js
index 5402daccdc..0aee8648bb 100644
--- a/Task/100-doors/JavaScript/100-doors-1.js
+++ b/Task/100-doors/JavaScript/100-doors-1.js
@@ -1,11 +1,6 @@
-(function(){var doors = [], n = 100, i, j;
-
-for (i = 1; i <= n; i++) {
- for (j = i; j <= n; j += i) {
- doors[j] = !doors[j];
- }
+for (var door = 1; door <= 100; i++) {
+ var sqrt = Math.sqrt(door);
+ if (sqrt === (sqrt | 0)) {
+ console.log("Door %d is open", door);
+ }
}
-
-for (i = 1 ; i <= n ; i++) {
- if (doors[i]) console.log("Door " + i + " is open");
-}}())
diff --git a/Task/100-doors/JavaScript/100-doors-2.js b/Task/100-doors/JavaScript/100-doors-2.js
index d4d2a0027c..7a4f61260e 100644
--- a/Task/100-doors/JavaScript/100-doors-2.js
+++ b/Task/100-doors/JavaScript/100-doors-2.js
@@ -1,19 +1,9 @@
-var
- n = 100,
- doors = [n],
- step,
- idx;
-// now, start opening and closing
-for (step = 1; step <= n; step += 1)
- for (idx = step; idx <= n; idx += step)
- // toggle state of door
- doors[idx] = !doors[idx];
+Array.apply(null, { length: 100 })
+ .map(function(v, i) { return i + 1; })
+ .forEach(function(door) {
+ var sqrt = Math.sqrt(door);
-// find out which doors are open
-var open = doors.reduce(function(open, val, idx) {
- if (val) {
- open.push(idx);
- }
- return open;
-}, []);
-document.write("These doors are open: " + open.join(', '));
+ if (sqrt === (sqrt | 0)) {
+ console.log("Door %d is open", door);
+ }
+ });
diff --git a/Task/100-doors/JavaScript/100-doors-3.js b/Task/100-doors/JavaScript/100-doors-3.js
new file mode 100644
index 0000000000..2e3d824574
--- /dev/null
+++ b/Task/100-doors/JavaScript/100-doors-3.js
@@ -0,0 +1,9 @@
+Array.apply(null, { length: 100 })
+ .map((v, i) => i + 1)
+ .forEach(door => {
+ var sqrt = Math.sqrt(door);
+
+ if (sqrt === (sqrt | 0)) {
+ console.log("Door %d is open", door);
+ }
+ });
diff --git a/Task/100-doors/JavaScript/100-doors-4.js b/Task/100-doors/JavaScript/100-doors-4.js
new file mode 100644
index 0000000000..7378d4bae5
--- /dev/null
+++ b/Task/100-doors/JavaScript/100-doors-4.js
@@ -0,0 +1,9 @@
+// Array comprehension style
+[ for (i of Array.apply(null, { length: 100 })) i ].forEach((_, i) => {
+ var door = i + 1
+ var sqrt = Math.sqrt(door);
+
+ if (sqrt === (sqrt | 0)) {
+ console.log("Door %d is open", door);
+ }
+});
diff --git a/Task/100-doors/Kotlin/100-doors.kotlin b/Task/100-doors/Kotlin/100-doors.kotlin
new file mode 100644
index 0000000000..8055e822a6
--- /dev/null
+++ b/Task/100-doors/Kotlin/100-doors.kotlin
@@ -0,0 +1,11 @@
+fun oneHundredDoors(): List"+this.count+" bottles of beer on the wall
" - +""+this.count+" bottles of beer!
" - +"Take one down,
Pass it around
"+(--this.count)+" bottles of beer on the wall
// for "commenting out" people.)
diff --git a/Task/Comments/Frink/comments.frink b/Task/Comments/Frink/comments.frink
new file mode 100644
index 0000000000..0471859017
--- /dev/null
+++ b/Task/Comments/Frink/comments.frink
@@ -0,0 +1,6 @@
+// This is a single-line comment
+
+/* This is a comment
+ that spans multiple lines
+ and so on.
+*/
diff --git a/Task/Comments/Maple/comments.maple b/Task/Comments/Maple/comments.maple
new file mode 100644
index 0000000000..63bc4e4bd8
--- /dev/null
+++ b/Task/Comments/Maple/comments.maple
@@ -0,0 +1,5 @@
+x := 4: x; # Everything on this line, after this, is a comment.
+
+17; (* This
+ is
+ a multiline comment *) 23.4;
diff --git a/Task/Concurrent-computing/Rust/concurrent-computing.rust b/Task/Concurrent-computing/Rust/concurrent-computing.rust
new file mode 100644
index 0000000000..2b357f2a7f
--- /dev/null
+++ b/Task/Concurrent-computing/Rust/concurrent-computing.rust
@@ -0,0 +1,15 @@
+use std::io::timer::sleep;
+use std::rand::{rng, Rng};
+
+fn main() {
+ let mut random = rng();
+ for word in "Enjoy Rosetta Code".words() {
+ let local_word = word.to_owned();
+ let snooze_time = random.gen_range::| X | Y | Z | |
| %2i | %5i | %5i | %5i |
| X | Y | Z | |
| 1 | 10 | 100 | 999 |
| 2 | 20 | 200 | 1999 |
| 3 | 30 | 300 | 2999 |
| 4 | 40 | 400 | 3999 |
| 5 | 50 | 500 | 4999 |
| 6 | 60 | 600 | 5999 |
| 7 | 70 | 700 | 6999 |
| 8 | 80 | 800 | 7999 |
| 9 | 90 | 900 | 8999 |
| 10 | 100 | 1000 | 9999 |
| X | Y | Z | |
| %2i | %5i | %5i | %5i |
define func1( paramname1, paramname2); then it could be called normally as func1(argument1, argument2) and in the called function paramname1 would be associated with argument1 and paramname2 with argument2.
+: For example, if a function were to be defined as define func1( paramname1, paramname2); then it could be called normally as func1(argument1, argument2) and in the called function paramname1 would be associated with argument1 and paramname2 with argument2.
: func1 '''must also be able to be called in a way that visually binds each parameter to its respective argument, irrespective of argument order''', for example: func1(paramname2=argument2, paramname1=argument1) which ''explicitly'' makes the same parameter/argument bindings as before.
: Named parameters are often a feature of languages used in safety critical areas such as [[wp:Verilog|Verilog]] and [[wp:VHDL|VHDL]].
diff --git a/Task/Named-parameters/Applesoft-BASIC/named-parameters.applesoft b/Task/Named-parameters/Applesoft-BASIC/named-parameters.applesoft
new file mode 100644
index 0000000000..f4542b11e6
--- /dev/null
+++ b/Task/Named-parameters/Applesoft-BASIC/named-parameters.applesoft
@@ -0,0 +1,6 @@
+ 100 IF LAST$ = "" THEN PRINT "?";
+ 110 IF LAST$ < > "" THEN PRINT LAST$;
+ 120 IF FIRST$ < > "" THEN PRINT ", "FIRST$;
+ 200 FIRST$ = ""
+ 210 LAST$ = ""
+ 220 RETURN
diff --git a/Task/Named-parameters/Bracmat/named-parameters.bracmat b/Task/Named-parameters/Bracmat/named-parameters.bracmat
new file mode 100644
index 0000000000..8ed2f4b250
--- /dev/null
+++ b/Task/Named-parameters/Bracmat/named-parameters.bracmat
@@ -0,0 +1,20 @@
+( ( testproc
+ = i x y z
+ . out$"Calling testproc"
+ & (=~):(=?i:?x:?y:?z) { initialise variables to 'failure' }
+ & !arg
+ : (? (i,?i) ?|?) { if "i" found, assign value to i. Otherwise just match with no side effect. }
+ : (? (x,?x) ?|?) { if "x" found, assign value to x. Otherwise just match with no side effect. }
+ : (? (y,?y) ?|?) { likewise }
+ : (? (z,?z) ?|?) { likewise }
+ & (~!i|put$(" i:=" !i)) { if variable doesn't fail, show its value }
+ & (~!x|put$(" x:=" !x))
+ & (~!y|put$(" y:=" !y))
+ & (~!z|put$(" z:=" !z))
+ & put$\n { add new line }
+ )
+& testproc$((x,1) (y,2) (z,3))
+& testproc$((x,3) (y,1) (z,2))
+& testproc$((z,4) (x,2) (y,3)) { order is not important }
+& testproc$((i,1) (y,2) (z,3))
+);
diff --git a/Task/Named-parameters/Objective-C/named-parameters-1.m b/Task/Named-parameters/Objective-C/named-parameters-1.m
index 6484c94c23..62519e41f1 100644
--- a/Task/Named-parameters/Objective-C/named-parameters-1.m
+++ b/Task/Named-parameters/Objective-C/named-parameters-1.m
@@ -1,4 +1,4 @@
-@interface Demo : Object {
+@interface Demo : NSObject {
// Omitted ...
}
diff --git a/Task/Non-decimal-radices-Convert/MATLAB/non-decimal-radices-convert.m b/Task/Non-decimal-radices-Convert/MATLAB/non-decimal-radices-convert.m
new file mode 100644
index 0000000000..292aa9a170
--- /dev/null
+++ b/Task/Non-decimal-radices-Convert/MATLAB/non-decimal-radices-convert.m
@@ -0,0 +1,2 @@
+dec2base(26,16)
+base2dec('1a', 16)
diff --git a/Task/Nth-root/Maple/nth-root.maple b/Task/Nth-root/Maple/nth-root.maple
new file mode 100644
index 0000000000..8b4c8f0cb3
--- /dev/null
+++ b/Task/Nth-root/Maple/nth-root.maple
@@ -0,0 +1,5 @@
+root(1728, 3);
+
+root(1024, 10);
+
+root(2.0, 2);
diff --git a/Task/Null-object/C++/null-object-3.cpp b/Task/Null-object/C++/null-object-3.cpp
new file mode 100644
index 0000000000..b15507ce40
--- /dev/null
+++ b/Task/Null-object/C++/null-object-3.cpp
@@ -0,0 +1,5 @@
+int *p = nullptr;
+...
+if(p == nullptr){
+ // do some thing
+}
diff --git a/Task/Object-serialization/Objective-C/object-serialization.m b/Task/Object-serialization/Objective-C/object-serialization.m
index 679b23ad86..1d9b843433 100644
--- a/Task/Object-serialization/Objective-C/object-serialization.m
+++ b/Task/Object-serialization/Objective-C/object-serialization.m
@@ -6,15 +6,12 @@
NSString *animalName;
int numberOfLegs;
}
-- (id) initWithName: (NSString*)name andLegs: (NSInteger)legs;
+- (instancetype) initWithName: (NSString*)name andLegs: (NSInteger)legs;
- (void) dump;
-// the following allows "(de)archiving" of the object
-- (void) encodeWithCoder: (NSCoder*)coder;
-- (id) initWithCoder: (NSCoder*)coder;
@end
@implementation Animal
-- (id) initWithName: (NSString*)name andLegs: (NSInteger)legs
+- (instancetype) initWithName: (NSString*)name andLegs: (NSInteger)legs
{
if ((self = [super init])) {
animalName = [name retain];
@@ -22,11 +19,6 @@
}
return self;
}
-- (void) dealloc
-{
- [animalName release];
- [super dealloc];
-}
- (void) dump
{
NSLog(@"%@ has %d legs", animalName, numberOfLegs);
@@ -52,16 +44,12 @@
BOOL hasFur;
NSMutableArray *eatenList;
}
-- (id) initWithName: (NSString*)name hasFur: (BOOL)fur;
+- (instancetype) initWithName: (NSString*)name hasFur: (BOOL)fur;
- (void) addEatenThing: (NSString*)thing;
-- (void) dump;
-// for archiving / dearchiving:
-- (void) encodeWithCoder: (NSCoder*)coder;
-- (id) initWithCoder: (NSCoder*)coder;
@end
@implementation Mammal
-- (id) init
+- (instancetype) init
{
if ((self = [super init])) {
hasFur = NO;
@@ -69,7 +57,7 @@
}
return self;
}
-- (id) initWithName: (NSString*)name hasFur: (BOOL)fur
+- (instancetype) initWithName: (NSString*)name hasFur: (BOOL)fur
{
if ((self = [super initWithName: name andLegs: 4])) {
hasFur = fur;
@@ -81,21 +69,12 @@
{
[eatenList addObject: thing];
}
-- (void) dealloc
-{
- [eatenList release];
- [super dealloc];
-}
- (void) dump
{
[super dump];
NSLog(@"has fur? %@", (hasFur) ? @"yes" : @"no" );
- // fast enum not implemented yet in gcc 4.3, at least
- // without a patch that it seems to exist...
- NSEnumerator *en = [eatenList objectEnumerator];
- id element;
NSLog(@"it has eaten %d things:", [eatenList count]);
- while( (element = [en nextObject]) != nil )
+ for ( id element in eatenList )
NSLog(@"it has eaten a %@", element);
NSLog(@"end of eaten things list");
}
@@ -110,7 +89,7 @@
{
if ((self = [super initWithCoder: coder])) {
hasFur = [coder decodeBoolForKey: @"Mammal.hasFur"];
- eatenList = [[coder decodeObjectForKey: @"Mammal.eaten"] retain];
+ eatenList = [coder decodeObjectForKey: @"Mammal.eaten"];
}
return self;
}
@@ -119,67 +98,59 @@
int main()
{
- Mammal *aMammal;
- Animal *anAnimal;
- NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+ @autoreleasepool {
- // let us create a fantasy animal
- anAnimal = [[Animal alloc]
- initWithName: @"Eptohippos"
- andLegs: 7
- ];
- // for some reason an Eptohippos is not an horse with 7 legs,
- // and it is not a mammal, of course...
+ // let us create a fantasy animal
+ Animal *anAnimal = [[Animal alloc]
+ initWithName: @"Eptohippos"
+ andLegs: 7
+ ];
+ // for some reason an Eptohippos is not an horse with 7 legs,
+ // and it is not a mammal, of course...
- // let us create a fantasy mammal (which is an animal too)
- aMammal = [[Mammal alloc]
- initWithName: @"Mammaluc"
- hasFur: YES
- ];
- // let us add some eaten stuff...
- [aMammal addEatenThing: @"lamb"];
- [aMammal addEatenThing: @"table"];
- [aMammal addEatenThing: @"web page"];
+ // let us create a fantasy mammal (which is an animal too)
+ Mammal *aMammal = [[Mammal alloc]
+ initWithName: @"Mammaluc"
+ hasFur: YES
+ ];
+ // let us add some eaten stuff...
+ [aMammal addEatenThing: @"lamb"];
+ [aMammal addEatenThing: @"table"];
+ [aMammal addEatenThing: @"web page"];
- // dump anAnimal
- NSLog(@"----- original Animal -----");
- [anAnimal dump];
+ // dump anAnimal
+ NSLog(@"----- original Animal -----");
+ [anAnimal dump];
- // dump aMammal...
- NSLog(@"----- original Mammal -----");
- [aMammal dump];
+ // dump aMammal...
+ NSLog(@"----- original Mammal -----");
+ [aMammal dump];
- // now let us store the objects...
- NSMutableData *data = [[NSMutableData alloc] init];
- NSKeyedArchiver *arch = [[NSKeyedArchiver alloc]
- initForWritingWithMutableData: data];
- [arch encodeObject: anAnimal forKey: @"Eptohippos"];
- [arch encodeObject: aMammal forKey: @"Mammaluc"];
- [anAnimal release];
- [aMammal release];
- [arch finishEncoding];
- [arch release];
- [data writeToFile: @"objects.dat" atomically: YES];
- [data release];
+ // now let us store the objects...
+ NSMutableData *data = [[NSMutableData alloc] init];
+ NSKeyedArchiver *arch = [[NSKeyedArchiver alloc]
+ initForWritingWithMutableData: data];
+ [arch encodeObject: anAnimal forKey: @"Eptohippos"];
+ [arch encodeObject: aMammal forKey: @"Mammaluc"];
+ [arch finishEncoding];
+ [data writeToFile: @"objects.dat" atomically: YES];
- // now we want to retrieve the saved objects...
- NSData *ldata = [[NSData alloc]
- initWithContentsOfFile: @"objects.dat"];
- NSKeyedUnarchived *darch = [[NSKeyedUnarchiver alloc]
- initForReadingWithData: ldata];
- Animal *archivedAnimal = [darch decodeObjectForKey: @"Eptohippos"];
- Mammal *archivedMammal = [darch decodeObjectForKey: @"Mammaluc"];
- [darch finishDecoding];
- [ldata release];
- [darch release];
+ // now we want to retrieve the saved objects...
+ NSData *ldata = [[NSData alloc]
+ initWithContentsOfFile: @"objects.dat"];
+ NSKeyedUnarchived *darch = [[NSKeyedUnarchiver alloc]
+ initForReadingWithData: ldata];
+ Animal *archivedAnimal = [darch decodeObjectForKey: @"Eptohippos"];
+ Mammal *archivedMammal = [darch decodeObjectForKey: @"Mammaluc"];
+ [darch finishDecoding];
- // now let's dump/print the objects...
- NSLog(@"\n");
- NSLog(@"----- the archived Animal -----");
- [archivedAnimal dump];
- NSLog(@"----- the archived Mammal -----");
- [archivedMammal dump];
+ // now let's dump/print the objects...
+ NSLog(@"\n");
+ NSLog(@"----- the archived Animal -----");
+ [archivedAnimal dump];
+ NSLog(@"----- the archived Mammal -----");
+ [archivedMammal dump];
- [pool release];
+ }
return EXIT_SUCCESS;
}
diff --git a/Task/One-dimensional-cellular-automata/Clojure/one-dimensional-cellular-automata-3.clj b/Task/One-dimensional-cellular-automata/Clojure/one-dimensional-cellular-automata-3.clj
new file mode 100644
index 0000000000..c8d0847ca3
--- /dev/null
+++ b/Task/One-dimensional-cellular-automata/Clojure/one-dimensional-cellular-automata-3.clj
@@ -0,0 +1,25 @@
+#!/usr/bin/env lein-exec
+
+(require '[clojure.string :as str])
+
+(def first-genr "_###_##_#_#_#_#__#__")
+
+(def hospitable #{"_##"
+ "##_"
+ "#_#"})
+
+(defn compute-next-genr
+ [genr]
+ (let [genr (str "_" genr "_")
+ groups (map str/join (partition 3 1 genr))
+ next-genr (for [g groups]
+ (if (hospitable g) \# \_))]
+ (str/join next-genr)))
+
+;; ---------------- main -----------------
+(loop [g first-genr
+ i 0]
+ (if (not= i 10)
+ (do (println g)
+ (recur (compute-next-genr g)
+ (inc i)))))
diff --git a/Task/One-dimensional-cellular-automata/Clojure/one-dimensional-cellular-automata-4.clj b/Task/One-dimensional-cellular-automata/Clojure/one-dimensional-cellular-automata-4.clj
new file mode 100644
index 0000000000..beef9ca3d3
--- /dev/null
+++ b/Task/One-dimensional-cellular-automata/Clojure/one-dimensional-cellular-automata-4.clj
@@ -0,0 +1,23 @@
+(def rules
+ {
+ [0 0 0] 0
+ [0 0 1] 0
+ [0 1 0] 0
+ [0 1 1] 1
+ [1 0 0] 0
+ [1 0 1] 1
+ [1 1 0] 1
+ [1 1 1] 0
+ })
+
+(defn nextgen [gen]
+ (concat [0]
+ (->> gen
+ (partition 3 1)
+ (map vec)
+ (map rules))
+ [0]))
+
+; Output time!
+(doseq [g (take 10 (iterate nextgen [0 1 1 1 0 1 1 0 1 0 1 0 1 0 1 0 0 1 0 0]))]
+ (println g))
diff --git a/Task/One-dimensional-cellular-automata/D/one-dimensional-cellular-automata-1.d b/Task/One-dimensional-cellular-automata/D/one-dimensional-cellular-automata-1.d
index f479ef84ce..a6b28d3374 100644
--- a/Task/One-dimensional-cellular-automata/D/one-dimensional-cellular-automata-1.d
+++ b/Task/One-dimensional-cellular-automata/D/one-dimensional-cellular-automata-1.d
@@ -1,19 +1,19 @@
-import std.stdio, std.algorithm;
-
void main() {
- enum ngenerations = 10;
+ import std.stdio, std.algorithm;
+
+ enum nGenerations = 10;
enum initial = "0011101101010101001000";
enum table = "00010110";
char[initial.length + 2] A = '0', B = '0';
A[1 .. $-1] = initial;
- foreach (_; 0 .. ngenerations) {
- foreach (i; 1 .. A.length-1) {
+ foreach (immutable _; 0 .. nGenerations) {
+ foreach (immutable i; 1 .. A.length - 1) {
write(A[i] == '0' ? '_' : '#');
- int val = (A[i-1]-'0' << 2) | (A[i]-'0' << 1) | (A[i+1]-'0');
+ const val = (A[i-1]-'0' << 2) | (A[i]-'0' << 1) | (A[i+1]-'0');
B[i] = table[val];
}
- swap(A, B);
- writeln();
+ A.swap(B);
+ writeln;
}
}
diff --git a/Task/One-dimensional-cellular-automata/D/one-dimensional-cellular-automata-2.d b/Task/One-dimensional-cellular-automata/D/one-dimensional-cellular-automata-2.d
index 6db90f04da..37fa5123d5 100644
--- a/Task/One-dimensional-cellular-automata/D/one-dimensional-cellular-automata-2.d
+++ b/Task/One-dimensional-cellular-automata/D/one-dimensional-cellular-automata-2.d
@@ -1,14 +1,13 @@
-import std.stdio, std.algorithm, std.array, std.range;
-
void main() {
+ import std.stdio, std.algorithm, std.range;
+
auto A = "_###_##_#_#_#_#__#__".map!q{a == '#'}.array;
auto B = A.dup;
do {
A.map!q{ "_#"[a] }.writeln;
- zip(A, A.cycle.drop(1), A.cycle.drop(A.length - 1))
- //.map!(t => [t[]].sum == 2).copy(B);
- .map!q{ a[0] + a[1] + a[2] == 2 }.copy(B);
+ A.zip(A.cycle.drop(1), A.cycle.drop(A.length - 1))
+ .map!(t => [t[]].sum == 2).copy(B);
A.swap(B);
} while (A != B);
}
diff --git a/Task/One-dimensional-cellular-automata/D/one-dimensional-cellular-automata-3.d b/Task/One-dimensional-cellular-automata/D/one-dimensional-cellular-automata-3.d
index 0803473de1..f3c54783ce 100644
--- a/Task/One-dimensional-cellular-automata/D/one-dimensional-cellular-automata-3.d
+++ b/Task/One-dimensional-cellular-automata/D/one-dimensional-cellular-automata-3.d
@@ -1,25 +1,20 @@
-import std.stdio, std.algorithm, std.array, std.range, std.bitmanip;
-
-immutable initial = "__###_##_#_#_#_#__#___";
-enum numGenerations = 10;
-
void main() {
+ import std.stdio, std.algorithm, std.range, std.bitmanip;
+
+ immutable initial = "__###_##_#_#_#_#__#___";
+ enum nGenerations = 10;
BitArray A, B;
- A.length = initial.length;
+ A.init(initial.map!(c => c == '#').array);
B.length = initial.length;
- // auto A = BitArray(initial.map!(c => c == '#'));
- foreach (immutable i, immutable c; initial)
- A[i] = c == '#';
-
- foreach (immutable _; 0 .. numGenerations) {
- //A.map!(b => b ? '#' : '_').weiteln;
+ foreach (immutable _; 0 .. nGenerations) {
+ //A.map!(b => b ? '#' : '_').writeln;
//foreach (immutable i, immutable b; A) {
foreach (immutable i; 1 .. A.length - 1) {
"_#"[A[i]].write;
immutable val = (cast(uint)A[i - 1] << 2) |
(cast(uint)A[i] << 1) |
- cast(uint)A[i + 1];
+ cast(uint)A[i + 1];
B[i] = val == 3 || val == 5 || val == 6;
}
diff --git a/Task/One-dimensional-cellular-automata/Deja-Vu/one-dimensional-cellular-automata.djv b/Task/One-dimensional-cellular-automata/Deja-Vu/one-dimensional-cellular-automata.djv
new file mode 100644
index 0000000000..b1415538c6
--- /dev/null
+++ b/Task/One-dimensional-cellular-automata/Deja-Vu/one-dimensional-cellular-automata.djv
@@ -0,0 +1,36 @@
+new-state size:
+ 0 ]
+ repeat size:
+ random-range 0 2
+ [ 0
+
+update s1 s2:
+ for i range 1 - len s1 2:
+ s1! -- i
+ s1! i
+ s1! ++ i
+ + +
+ set-to s2 i = 2
+ s2 s1
+
+print-state s:
+ for i range 1 - len s 2:
+ !print\ s! i
+ !print ""
+
+same-state s1 s2:
+ for i range 1 - len s1 2:
+ if /= s1! i s2! i:
+ return false
+ true
+
+run size:
+ new-state size
+ new-state size
+ while true:
+ update
+ print-state over
+ if same-state over over:
+ return print-state drop
+
+run 60
diff --git a/Task/One-dimensional-cellular-automata/Go/one-dimensional-cellular-automata-1.go b/Task/One-dimensional-cellular-automata/Go/one-dimensional-cellular-automata-1.go
new file mode 100644
index 0000000000..78a64d3026
--- /dev/null
+++ b/Task/One-dimensional-cellular-automata/Go/one-dimensional-cellular-automata-1.go
@@ -0,0 +1,38 @@
+package main
+
+import "fmt"
+
+const (
+ start = "_###_##_#_#_#_#__#__"
+ offLeft = '_'
+ offRight = '_'
+ dead = '_'
+)
+
+func main() {
+ fmt.Println(start)
+ g := newGenerator(start, offLeft, offRight, dead)
+ for i := 0; i < 10; i++ {
+ fmt.Println(g())
+ }
+}
+
+func newGenerator(start string, offLeft, offRight, dead byte) func() string {
+ g0 := string(offLeft) + start + string(offRight)
+ g1 := []byte(g0)
+ last := len(g0) - 1
+ return func() string {
+ for i := 1; i < last; i++ {
+ switch l := g0[i-1]; {
+ case l != g0[i+1]:
+ g1[i] = g0[i]
+ case g0[i] == dead:
+ g1[i] = l
+ default:
+ g1[i] = dead
+ }
+ }
+ g0 = string(g1)
+ return g0[1:last]
+ }
+}
diff --git a/Task/One-dimensional-cellular-automata/Go/one-dimensional-cellular-automata-2.go b/Task/One-dimensional-cellular-automata/Go/one-dimensional-cellular-automata-2.go
new file mode 100644
index 0000000000..92e57a32f4
--- /dev/null
+++ b/Task/One-dimensional-cellular-automata/Go/one-dimensional-cellular-automata-2.go
@@ -0,0 +1,55 @@
+package main
+
+import (
+ "fmt"
+ "sync"
+)
+
+const (
+ start = "_###_##_#_#_#_#__#__"
+ offLeft = '_'
+ offRight = '_'
+ dead = '_'
+)
+
+func main() {
+ fmt.Println(start)
+ a := make([]byte, len(start)+2)
+ a[0] = offLeft
+ copy(a[1:], start)
+ a[len(a)-1] = offRight
+ var read, write sync.WaitGroup
+ read.Add(len(start) + 1)
+ for i := 1; i <= len(start); i++ {
+ go cell(a[i-1:i+2], &read, &write)
+ }
+ for i := 0; i < 10; i++ {
+ write.Add(len(start) + 1)
+ read.Done()
+ read.Wait()
+ read.Add(len(start) + 1)
+ write.Done()
+ write.Wait()
+ fmt.Println(string(a[1 : len(a)-1]))
+ }
+}
+
+func cell(kernel []byte, read, write *sync.WaitGroup) {
+ var next byte
+ for {
+ l, v, r := kernel[0], kernel[1], kernel[2]
+ read.Done()
+ switch {
+ case l != r:
+ next = v
+ case v == dead:
+ next = l
+ default:
+ next = dead
+ }
+ read.Wait()
+ kernel[1] = next
+ write.Done()
+ write.Wait()
+ }
+}
diff --git a/Task/One-dimensional-cellular-automata/Go/one-dimensional-cellular-automata.go b/Task/One-dimensional-cellular-automata/Go/one-dimensional-cellular-automata.go
deleted file mode 100644
index be1e4b6f1a..0000000000
--- a/Task/One-dimensional-cellular-automata/Go/one-dimensional-cellular-automata.go
+++ /dev/null
@@ -1,26 +0,0 @@
-package main
-
-import "fmt"
-
-const start = "_###_##_#_#_#_#__#__"
-
-func main() {
- g0 := []byte(start)
- g1 := []byte(start)
- fmt.Println(string(g0))
- last := len(g0) - 1
- for g := 0; g < 10; g++ {
- for i := 1; i < last; i++ {
- switch {
- case g0[i-1] != g0[i+1]:
- g1[i] = g0[i]
- case g0[i] == '_':
- g1[i] = g0[i-1]
- default:
- g1[i] = '_'
- }
- }
- fmt.Println(string(g1))
- copy(g0, g1)
- }
-}
diff --git a/Task/One-dimensional-cellular-automata/Perl-6/one-dimensional-cellular-automata-1.pl6 b/Task/One-dimensional-cellular-automata/Perl-6/one-dimensional-cellular-automata-1.pl6
new file mode 100644
index 0000000000..76e167eb4d
--- /dev/null
+++ b/Task/One-dimensional-cellular-automata/Perl-6/one-dimensional-cellular-automata-1.pl6
@@ -0,0 +1,14 @@
+class Automata {
+ has ($.rule, @.cells);
+ method gist { <| |>.join: @!cells.map({$_ ?? '#' !! ' '}).join }
+ method code { $.rule.fmt("%08b").comb.reverse }
+ method succ {
+ self.new: :$.rule, :cells(
+ self.code[
+ [Z+] 4 «*« @.cells.rotate(-1),
+ 2 «*« @.cells,
+ @.cells.rotate(1)
+ ]
+ )
+ }
+}
diff --git a/Task/One-dimensional-cellular-automata/Perl-6/one-dimensional-cellular-automata-2.pl6 b/Task/One-dimensional-cellular-automata/Perl-6/one-dimensional-cellular-automata-2.pl6
new file mode 100644
index 0000000000..0eecb411bc
--- /dev/null
+++ b/Task/One-dimensional-cellular-automata/Perl-6/one-dimensional-cellular-automata-2.pl6
@@ -0,0 +1,5 @@
+my $size = 10;
+my Automata $a .= new:
+ :rule(104),
+ :cells( 0 xx $size div 2, '111011010101'.comb, 0 xx $size div 2 );
+say $a++ for ^10;
diff --git a/Task/One-dimensional-cellular-automata/Perl-6/one-dimensional-cellular-automata-3.pl6 b/Task/One-dimensional-cellular-automata/Perl-6/one-dimensional-cellular-automata-3.pl6
new file mode 100644
index 0000000000..40de91d1b0
--- /dev/null
+++ b/Task/One-dimensional-cellular-automata/Perl-6/one-dimensional-cellular-automata-3.pl6
@@ -0,0 +1,4 @@
+my $size = 50;
+my Automata $a .= new: :rule(90), :cells( 0 xx $size div 2, 1, 0 xx $size div 2 );
+
+say $a++ for ^20;
diff --git a/Task/One-dimensional-cellular-automata/Perl-6/one-dimensional-cellular-automata.pl6 b/Task/One-dimensional-cellular-automata/Perl-6/one-dimensional-cellular-automata.pl6
deleted file mode 100644
index f5e55587d7..0000000000
--- a/Task/One-dimensional-cellular-automata/Perl-6/one-dimensional-cellular-automata.pl6
+++ /dev/null
@@ -1,7 +0,0 @@
-my @c = <_ #>;
-my @array = '_###_##_#_#_#_#__#__'.comb »eq» '#';
-
-repeat until @array eqv my @prev {
- say @c[@prev = @array].join;
- @array = ((@array Z+ @array.rotate(1)) Z+ @array.rotate(-1)) X== 2;
-}
diff --git a/Task/One-of-n-lines-in-a-file/D/one-of-n-lines-in-a-file.d b/Task/One-of-n-lines-in-a-file/D/one-of-n-lines-in-a-file.d
index c2ba2bc0df..14e40b8a91 100644
--- a/Task/One-of-n-lines-in-a-file/D/one-of-n-lines-in-a-file.d
+++ b/Task/One-of-n-lines-in-a-file/D/one-of-n-lines-in-a-file.d
@@ -3,7 +3,7 @@ import std.stdio, std.random, std.algorithm;
// Zero-based line numbers.
int oneOfN(in int n) {
int choice = 0;
- foreach (i; 1 .. n)
+ foreach (immutable i; 1 .. n)
if (!uniform(0, i + 1))
choice = i;
return choice;
@@ -11,9 +11,9 @@ int oneOfN(in int n) {
void main() {
int[10] bins;
- foreach (i; 0 .. 1_000_000)
- bins[oneOfN(10)]++;
+ foreach (immutable i; 0 .. 1_000_000)
+ bins[10.oneOfN]++;
- writeln(bins);
- writeln("Total of bins: ", reduce!q{a + b}(bins[]));
+ bins.writeln;
+ writeln("Total of bins: ", bins[].sum);
}
diff --git a/Task/OpenGL/Go/opengl.go b/Task/OpenGL/Go/opengl.go
index af8cb771e5..783b58133d 100644
--- a/Task/OpenGL/Go/opengl.go
+++ b/Task/OpenGL/Go/opengl.go
@@ -7,7 +7,7 @@ import (
"time"
gl "github.com/chsc/gogl/gl21"
- "github.com/mewmew/win"
+ "github.com/mewmew/glfw/win"
)
// Window dimensions.
diff --git a/Task/Ordered-Partitions/D/ordered-partitions.d b/Task/Ordered-Partitions/D/ordered-partitions.d
index 4158d5997d..be79eddedc 100644
--- a/Task/Ordered-Partitions/D/ordered-partitions.d
+++ b/Task/Ordered-Partitions/D/ordered-partitions.d
@@ -1,22 +1,21 @@
import std.stdio, std.algorithm, std.range, std.array, std.conv;
-// http://rosettacode.org/wiki/Combinations#D
import combinations4: Comb;
-alias int[] iRNG;
+alias iRNG = int[];
iRNG setDiff(iRNG s, iRNG c) {
- return setDifference(s, c).array();
+ return setDifference(s, c).array;
}
iRNG[][] orderPart(iRNG blockSize...) {
- iRNG sum = iota(1, 1 + blockSize.reduce!q{a + b}()).array();
+ iRNG sum = iota(1, 1 + blockSize.sum).array;
iRNG[][] p(iRNG s, in iRNG b) {
if (b.length == 0)
return [[]];
iRNG[][] res;
foreach (c; Comb.On(s, b[0]))
- foreach (r; p(setDiff(s, c), b[1 .. $]))
+ foreach (r; p(setDiff(s, c), b.dropOne))
res ~= c.dup ~ r;
return res;
}
@@ -24,11 +23,7 @@ iRNG[][] orderPart(iRNG blockSize...) {
return p(sum, blockSize);
}
-void main(string[] args) {
- auto b = args.length > 1 ?
- args[1 .. $].map!(to!int)().array() :
- [2, 0, 2];
-
- foreach (p; orderPart(b))
- writeln(p);
+void main(in string[] args) {
+ auto b = args.length > 1 ? args.dropOne.to!(int[]) : [2, 0, 2];
+ writefln("%(%s\n%)", b.orderPart);
}
diff --git a/Task/Palindrome-detection/Frink/palindrome-detection.frink b/Task/Palindrome-detection/Frink/palindrome-detection.frink
new file mode 100644
index 0000000000..27534defbc
--- /dev/null
+++ b/Task/Palindrome-detection/Frink/palindrome-detection.frink
@@ -0,0 +1 @@
+isPalindrome[x] := x == reverse[x]
diff --git a/Task/Palindrome-detection/Maple/palindrome-detection.maple b/Task/Palindrome-detection/Maple/palindrome-detection.maple
new file mode 100644
index 0000000000..41ae435f2d
--- /dev/null
+++ b/Task/Palindrome-detection/Maple/palindrome-detection.maple
@@ -0,0 +1,7 @@
+with(StringTools):
+
+IsPalindrome("ingirumimusnocteetconsumimurigni");
+
+IsPalindrome("In girum imus nocte et consumimur igni");
+
+IsPalindrome(LowerCase(DeleteSpace("In girum imus nocte et consumimur igni")));
diff --git a/Task/Parallel-calculations/D/parallel-calculations-1.d b/Task/Parallel-calculations/D/parallel-calculations-1.d
index a9dfdd1e5b..689495b1a9 100644
--- a/Task/Parallel-calculations/D/parallel-calculations-1.d
+++ b/Task/Parallel-calculations/D/parallel-calculations-1.d
@@ -1,6 +1,16 @@
-import std.stdio, std.algorithm, std.parallelism, std.typecons;
+ulong[] decompose(ulong n) pure nothrow {
+ typeof(return) result;
+ for (ulong i = 2; n >= i * i; i++)
+ for (; n % i == 0; n /= i)
+ result ~= i;
+ if (n != 1)
+ result ~= n;
+ return result;
+}
void main() {
+ import std.stdio, std.algorithm, std.parallelism, std.typecons;
+
immutable ulong[] data = [
2UL^^59-1, 2UL^^59-1, 2UL^^59-1, 112_272_537_195_293UL,
115_284_584_522_153, 115_280_098_190_773,
@@ -8,9 +18,10 @@ void main() {
112_272_537_095_293, 1_099_726_829_285_419];
//auto factors = taskPool.amap!(n => tuple(decompose(n), n))(data);
+ //static enum genPair = (ulong n) pure => tuple(decompose(n), n);
static genPair(ulong n) pure { return tuple(decompose(n), n); }
auto factors = taskPool.amap!genPair(data);
- auto pairs = map!(p => tuple(reduce!min(p[0]), p[1]))(factors);
- writeln("N. with largest min factor: ", reduce!max(pairs)[1]);
+ auto pairs = factors.map!(p => tuple(p[0].reduce!min, p[1]));
+ writeln("N. with largest min factor: ", pairs.reduce!max[1]);
}
diff --git a/Task/Parallel-calculations/D/parallel-calculations-2.d b/Task/Parallel-calculations/D/parallel-calculations-2.d
index 0ce26090c7..41cdec6617 100644
--- a/Task/Parallel-calculations/D/parallel-calculations-2.d
+++ b/Task/Parallel-calculations/D/parallel-calculations-2.d
@@ -25,14 +25,16 @@ final class MinFactor: Thread {
}
private void run() {
- immutable clock_t begin = clock();
+ immutable clock_t begin = clock;
switch (num) {
- case 0: fac = []; break;
+ case 0: fac = [];
+ break;
- case 1: fac = [1]; break;
+ case 1: fac = [1];
+ break;
default:
- uint limit = cast(uint)(1 + sqrt(cast(double)num));
+ uint limit = cast(uint)(1 + double(num).sqrt);
ulong n = num;
for (ulong divi = 3; divi < limit; divi += 2) {
if (n == 1)
@@ -42,14 +44,14 @@ final class MinFactor: Thread {
fac ~= divi;
n /= divi;
}
- limit = cast(uint)(1 + sqrt(cast(double)n));
+ limit = cast(uint)(1 + double(n).sqrt);
}
}
if (n > 1)
fac ~= n;
}
- minFac = reduce!min(fac);
- immutable clock_t end = clock();
+ minFac = fac.reduce!min;
+ immutable clock_t end = clock;
writefln("num: %20d --> min. factor: %20d ticks(%7d -> %7d)",
num, minFac, begin, end);
}
@@ -63,13 +65,13 @@ void main() {
112_272_537_095_293, 1_099_726_829_285_419];
auto tGroup = new ThreadGroup;
- foreach (n; numbers)
+ foreach (const n; numbers)
tGroup.add(new MinFactor(n));
writeln("Minimum factors for respective numbers are:");
foreach (t; tGroup)
- t.start();
- tGroup.joinAll();
+ t.start;
+ tGroup.joinAll;
auto maxMin = tuple(0UL, [0UL], 0UL);
foreach (thread; tGroup) {
diff --git a/Task/Parametric-polymorphism/Mercury/parametric-polymorphism.mercury b/Task/Parametric-polymorphism/Mercury/parametric-polymorphism.mercury
new file mode 100644
index 0000000000..afb49a3db2
--- /dev/null
+++ b/Task/Parametric-polymorphism/Mercury/parametric-polymorphism.mercury
@@ -0,0 +1,6 @@
+:- type tree(A) ---> empty ; node(A, tree(A), tree(A)).
+
+:- func map(func(A) = B, tree(A)) = tree(B).
+
+map(_, empty) = empty.
+map(F, node(A, Left, Right)) = node(F(A), map(F, Left), map(F, Right)).
diff --git a/Task/Parsing-RPN-calculator-algorithm/Common-Lisp/parsing-rpn-calculator-algorithm.lisp b/Task/Parsing-RPN-calculator-algorithm/Common-Lisp/parsing-rpn-calculator-algorithm.lisp
new file mode 100644
index 0000000000..82f4f2a170
--- /dev/null
+++ b/Task/Parsing-RPN-calculator-algorithm/Common-Lisp/parsing-rpn-calculator-algorithm.lisp
@@ -0,0 +1,20 @@
+(setf (symbol-function '^) #'expt) ; Make ^ an alias for EXPT
+
+(defun print-stack (token stack)
+ (format T "~a: ~{~a ~}~%" token (reverse stack)))
+
+(defun rpn (tokens &key stack verbose )
+ (cond
+ ((and (not tokens) (not stack)) 0)
+ ((not tokens) (car stack))
+ (T
+ (let* ((current (car tokens))
+ (next-stack (if (numberp current)
+ (cons current stack)
+ (let* ((arg2 (car stack))
+ (arg1 (cadr stack))
+ (fun (car tokens)))
+ (cons (funcall fun arg1 arg2) (cddr stack))))))
+ (when verbose
+ (print-stack current next-stack))
+ (rpn (cdr tokens) :stack next-stack :verbose verbose)))))
diff --git a/Task/Parsing-RPN-calculator-algorithm/Erlang/parsing-rpn-calculator-algorithm.erl b/Task/Parsing-RPN-calculator-algorithm/Erlang/parsing-rpn-calculator-algorithm.erl
new file mode 100644
index 0000000000..b450929e18
--- /dev/null
+++ b/Task/Parsing-RPN-calculator-algorithm/Erlang/parsing-rpn-calculator-algorithm.erl
@@ -0,0 +1,43 @@
+-module(rpn).
+-export([eval/1]).
+
+parse(Expression) ->
+ parse(string:tokens(Expression," "),[]).
+
+parse([],Expression) ->
+ lists:reverse(Expression);
+parse(["+"|Xs],Expression) ->
+ parse(Xs,[fun erlang:'+'/2|Expression]);
+parse(["-"|Xs],Expression) ->
+ parse(Xs,[fun erlang:'-'/2|Expression]);
+parse(["*"|Xs],Expression) ->
+ parse(Xs,[fun erlang:'*'/2|Expression]);
+parse(["/"|Xs],Expression) ->
+ parse(Xs,[fun erlang:'/'/2|Expression]);
+parse(["^"|Xs],Expression) ->
+ parse(Xs,[fun math:pow/2|Expression]);
+parse([X|Xs],Expression) ->
+ {N,_} = string:to_integer(X),
+ parse(Xs,[N|Expression]).
+
+%% The expression should be entered as a string of numbers and
+%% operators separated by spaces. No error handling is included if
+%% another string format is used.
+eval(Expression) ->
+ eval(parse(Expression),[]).
+
+eval([],[N]) ->
+ N;
+eval([N|Exp],Stack) when is_number(N) ->
+ NewStack = [N|Stack],
+ print(NewStack),
+ eval(Exp,NewStack);
+eval([F|Exp],[X,Y|Stack]) ->
+ NewStack = [F(Y,X)|Stack],
+ print(NewStack),
+ eval(Exp,NewStack).
+
+print(Stack) ->
+ lists:map(fun (X) when is_integer(X) -> io:format("~12.12b ",[X]);
+ (X) when is_float(X) -> io:format("~12f ",[X]) end, Stack),
+ io:format("~n").
diff --git a/Task/Parsing-RPN-calculator-algorithm/J/parsing-rpn-calculator-algorithm-3.j b/Task/Parsing-RPN-calculator-algorithm/J/parsing-rpn-calculator-algorithm-3.j
new file mode 100644
index 0000000000..08bf2c8b0f
--- /dev/null
+++ b/Task/Parsing-RPN-calculator-algorithm/J/parsing-rpn-calculator-algorithm-3.j
@@ -0,0 +1,7 @@
+rpn=: 3 :0
+ queue=. |.3 :'|.3 :y 0'::]each;: y
+ op=. 1 :'2 (u~/@:{.,}.)S:0 ,@]'
+ ops=. +op`(-op)`(*op)`(%op)`(^op)`(,&;)
+ choose=. ((;:'+-*/^')&i.@[)
+ ,ops@.choose/queue
+)
diff --git a/Task/Parsing-RPN-calculator-algorithm/J/parsing-rpn-calculator-algorithm-4.j b/Task/Parsing-RPN-calculator-algorithm/J/parsing-rpn-calculator-algorithm-4.j
new file mode 100644
index 0000000000..b87c8cf61b
--- /dev/null
+++ b/Task/Parsing-RPN-calculator-algorithm/J/parsing-rpn-calculator-algorithm-4.j
@@ -0,0 +1,2 @@
+ rpn '3 4 2 * 1 5 - 2 3 ^ ^ / +'
+3.00012
diff --git a/Task/Parsing-RPN-calculator-algorithm/J/parsing-rpn-calculator-algorithm-5.j b/Task/Parsing-RPN-calculator-algorithm/J/parsing-rpn-calculator-algorithm-5.j
new file mode 100644
index 0000000000..70b95b729b
--- /dev/null
+++ b/Task/Parsing-RPN-calculator-algorithm/J/parsing-rpn-calculator-algorithm-5.j
@@ -0,0 +1,7 @@
+rpnD=: 3 :0
+ queue=. |.3 :'|.3 :y 0'::]each;: y
+ op=. 1 :'2 (u~/@:{.,}.)S:0 ,@([smoutput)@]'
+ ops=. +op`(-op)`(*op)`(%op)`(^op)`(,&;)
+ choose=. ((;:'+-*/^')&i.@[)
+ ,ops@.choose/queue
+)
diff --git a/Task/Parsing-RPN-calculator-algorithm/J/parsing-rpn-calculator-algorithm-6.j b/Task/Parsing-RPN-calculator-algorithm/J/parsing-rpn-calculator-algorithm-6.j
new file mode 100644
index 0000000000..3095999c05
--- /dev/null
+++ b/Task/Parsing-RPN-calculator-algorithm/J/parsing-rpn-calculator-algorithm-6.j
@@ -0,0 +1,10 @@
+ rpnD '3 4 2 * 1 5 - 2 3 ^ ^ / +'
+┌─────┐
+│2 4 3│
+└─────┘
+5 1 8 3
+3 2 _4 8 3
+8 _4 8 3
+65536 8 3
+0.00012207 3
+3.00012
diff --git a/Task/Parsing-RPN-to-infix-conversion/D/parsing-rpn-to-infix-conversion-2.d b/Task/Parsing-RPN-to-infix-conversion/D/parsing-rpn-to-infix-conversion-2.d
index 5cfc56a488..37591ad73d 100644
--- a/Task/Parsing-RPN-to-infix-conversion/D/parsing-rpn-to-infix-conversion-2.d
+++ b/Task/Parsing-RPN-to-infix-conversion/D/parsing-rpn-to-infix-conversion-2.d
@@ -1,10 +1,10 @@
-import std.stdio, std.typecons, std.string, std.array, std.algorithm;
+import std.stdio, std.string, std.array, std.algorithm;
void rpmToInfix(in string str) {
- alias Exp = Tuple!(int,"p", string,"e");
+ static struct Exp { int p; string e; }
immutable P = (in Exp pair, in int prec) pure =>
pair.p < prec ? format("( %s )", pair.e) : pair.e;
- immutable F = (string[] s...) pure nothrow => s.join(" ");
+ immutable F = (in string[] s...) pure nothrow => s.join(" ");
writefln("=================\n%s", str);
Exp[] stack;
@@ -24,7 +24,7 @@ void rpmToInfix(in string str) {
default: throw new Error("Wrong part: " ~ w);
}
}
- stack.map!q{ a[1] }.writeln;
+ stack.map!q{ a.e }.writeln;
}
writeln("-----------------\n", stack.back.e);
}
diff --git a/Task/Parsing-RPN-to-infix-conversion/TXR/parsing-rpn-to-infix-conversion.txr b/Task/Parsing-RPN-to-infix-conversion/TXR/parsing-rpn-to-infix-conversion.txr
new file mode 100644
index 0000000000..7fec316924
--- /dev/null
+++ b/Task/Parsing-RPN-to-infix-conversion/TXR/parsing-rpn-to-infix-conversion.txr
@@ -0,0 +1,64 @@
+@(do
+ ;; alias for circumflex, which is reserved syntax
+ (defvar exp (intern "^"))
+
+ (defvar *prec* ^((,exp . 4) (* . 3) (/ . 3) (+ . 2) (- . 2)))
+
+ (defvar *asso* ^((,exp . :right) (* . nil)
+ (/ . :left) (+ . nil) (- . :left)))
+
+ (defun debug-print (label val)
+ (format t "~a: ~a\n" label val)
+ val)
+
+ (defun rpn-to-lisp (rpn)
+ (let (stack)
+ (each ((term rpn))
+ (if (symbolp (debug-print "rpn term" term))
+ (let ((right (pop stack))
+ (left (pop stack)))
+ (push ^(,term ,left ,right) stack))
+ (push term stack))
+ (debug-print "stack" stack))
+ (if (rest stack)
+ (return-from error "*excess stack elements*"))
+ (debug-print "lisp" (pop stack))))
+
+ (defun prec (term)
+ (or (cdr (assoc term *prec*)) 99))
+
+ (defun asso (term dfl)
+ (or (cdr (assoc term *asso*)) dfl))
+
+ (defun inf-term (op term left-or-right)
+ (if (atom term)
+ `@term`
+ (let ((pt (prec (car term)))
+ (po (prec op))
+ (at (asso (car term) left-or-right))
+ (ao (asso op left-or-right)))
+ (cond
+ ((< pt po) `(@(lisp-to-infix term))`)
+ ((> pt po) `@(lisp-to-infix term)`)
+ ((and (eq at ao) (eq left-or-right ao)) `@(lisp-to-infix term)`)
+ (t `(@(lisp-to-infix term))`)))))
+
+ (defun lisp-to-infix (lisp)
+ (tree-case lisp
+ ((op left right) (let ((left-inf (inf-term op left :left))
+ (right-inf (inf-term op right :right)))
+ `@{left-inf} @op @{right-inf}`))
+ (() (return-from error "*stack underflow*"))
+ (else `@lisp`)))
+
+ (defun string-to-rpn (str)
+ (debug-print "rpn"
+ (mapcar (do if (int-str @1) (int-str @1) (intern @1))
+ (tok-str str #/[^ \t]+/))))
+
+ (debug-print "infix"
+ (block error
+ (tree-case *args*
+ ((a b . c) "*excess args*")
+ ((a) (lisp-to-infix (rpn-to-lisp (string-to-rpn a))))
+ (else "*arg needed*")))))
diff --git a/Task/Parsing-Shunting-yard-algorithm/Perl-6/parsing-shunting-yard-algorithm.pl6 b/Task/Parsing-Shunting-yard-algorithm/Perl-6/parsing-shunting-yard-algorithm.pl6
new file mode 100644
index 0000000000..0f6ae573e3
--- /dev/null
+++ b/Task/Parsing-Shunting-yard-algorithm/Perl-6/parsing-shunting-yard-algorithm.pl6
@@ -0,0 +1,46 @@
+my %prec =
+ '^' => 4,
+ '*' => 3,
+ '/' => 3,
+ '+' => 2,
+ '-' => 2,
+ '(' => 1;
+
+my %assoc =
+ '^' => 'right',
+ '*' => 'left',
+ '/' => 'left',
+ '+' => 'left',
+ '-' => 'left';
+
+sub shunting-yard ($prog) {
+ my @inp = $prog.words;
+ my @ops;
+ my @res;
+
+ sub report($op) { printf "%25s %-7s %10s %s\n", ~@res, ~@ops, $op, ~@inp }
+ sub shift($t) { report( "shift $t"); @ops.push: $t }
+ sub reduce($t) { report("reduce $t"); @res.push: $t }
+
+ while @inp {
+ given @inp.shift {
+ when /\d/ { reduce $_ };
+ when '(' { shift $_ }
+ when ')' { while @ops and (my $x = @ops.pop and $x ne '(') { reduce $x } }
+ default {
+ my $newprec = %prec{$_};
+ while @ops {
+ my $oldprec = %prec{@ops[*-1]};
+ last if $newprec > $oldprec;
+ last if $newprec == $oldprec and %assoc{$_} eq 'right';
+ reduce @ops.pop;
+ }
+ shift $_;
+ }
+ }
+ }
+ reduce @ops.pop while @ops;
+ @res;
+}
+
+say shunting-yard '3 + 4 * 2 / ( 1 - 5 ) ^ 2 ^ 3';
diff --git a/Task/Parsing-Shunting-yard-algorithm/Perl/parsing-shunting-yard-algorithm.pl b/Task/Parsing-Shunting-yard-algorithm/Perl/parsing-shunting-yard-algorithm.pl
new file mode 100644
index 0000000000..2b67840cce
--- /dev/null
+++ b/Task/Parsing-Shunting-yard-algorithm/Perl/parsing-shunting-yard-algorithm.pl
@@ -0,0 +1,51 @@
+use 5.010;
+use strict;
+use warnings;
+
+my %prec = (
+ '^' => 4,
+ '*' => 3,
+ '/' => 3,
+ '+' => 2,
+ '-' => 2,
+ '(' => 1);
+
+my %assoc = (
+ '^' => 'right',
+ '*' => 'left',
+ '/' => 'left',
+ '+' => 'left',
+ '-' => 'left');
+
+sub shunting_yard {
+ my @inp = split ' ', $_[0];
+ my @ops;
+ my @res;
+
+ my $report = sub { printf "%25s %-7s %10s %s\n", "@res", "@ops", $_[0], "@inp" };
+ my $shift = sub { $report->( "shift @_"); push @ops, @_ };
+ my $reduce = sub { $report->("reduce @_"); push @res, @_ };
+
+ while( @inp ) {
+ given( shift @inp ) {
+ when ( /\d/ ) { $reduce->($_) }
+ when ( '(' ) { $shift->($_) }
+ when ( ')' ) { while( @ops and "(" ne (my $x = pop @ops) ) { $reduce->( $x ) } }
+ default {
+ my $newprec = $prec{$_};
+ while( @ops ) {
+ my $oldprec = $prec{$ops[-1]};
+ last if $newprec > $oldprec;
+ last if $newprec == $oldprec and $assoc{$_} eq 'right';
+ $reduce->( pop @ops );
+ }
+ $shift->( $_ );
+ }
+ }
+ }
+ $reduce->( pop @ops ) while @ops;
+ @res;
+}
+
+local $, = " ";
+say shunting_yard '3 + 4 * 2 / ( 1 - 5 ) ^ 2 ^ 3' ;
diff --git a/Task/Partial-function-application/Groovy/partial-function-application-1.groovy b/Task/Partial-function-application/Groovy/partial-function-application-1.groovy
new file mode 100644
index 0000000000..aa0bab7095
--- /dev/null
+++ b/Task/Partial-function-application/Groovy/partial-function-application-1.groovy
@@ -0,0 +1,5 @@
+def fs = { fn, values -> values.collect { fn(it) } }
+def f1 = { v -> v * 2 }
+def f2 = { v -> v ** 2 }
+def fsf1 = fs.curry(f1)
+def fsf2 = fs.curry(f2)
diff --git a/Task/Partial-function-application/Groovy/partial-function-application-2.groovy b/Task/Partial-function-application/Groovy/partial-function-application-2.groovy
new file mode 100644
index 0000000000..f2b39b9152
--- /dev/null
+++ b/Task/Partial-function-application/Groovy/partial-function-application-2.groovy
@@ -0,0 +1,4 @@
+[(0..3), (2..8).step(2)].each { seq ->
+ println "fsf1$seq = ${fsf1(seq)}"
+ println "fsf2$seq = ${fsf2(seq)}"
+}
diff --git a/Task/Partial-function-application/Haskell/partial-function-application.hs b/Task/Partial-function-application/Haskell/partial-function-application.hs
index 86750e6cf1..c8e4fb9ad5 100644
--- a/Task/Partial-function-application/Haskell/partial-function-application.hs
+++ b/Task/Partial-function-application/Haskell/partial-function-application.hs
@@ -1,6 +1,6 @@
-fs f s = map f s
-f1 value = value * 2
-f2 value = value ^ 2
+fs = map
+f1 = (* 2)
+f2 = (^ 2)
fsf1 = fs f1
fsf2 = fs f2
diff --git a/Task/Partial-function-application/PARI-GP/partial-function-application.pari b/Task/Partial-function-application/PARI-GP/partial-function-application.pari
new file mode 100644
index 0000000000..fbe251c701
--- /dev/null
+++ b/Task/Partial-function-application/PARI-GP/partial-function-application.pari
@@ -0,0 +1,9 @@
+fs=apply;
+f1(x)=2*x;
+f2(x)=x^2;
+fsf1=any->=fs(f1,any);
+fsf2=any->=fs(f2,any);
+fsf1([0..3])
+fsf1(2([1..4])
+fsf2([0..3])
+fsf2(2([1..4])
diff --git a/Task/Partial-function-application/TXR/partial-function-application-1.txr b/Task/Partial-function-application/TXR/partial-function-application-1.txr
new file mode 100644
index 0000000000..7b28261383
--- /dev/null
+++ b/Task/Partial-function-application/TXR/partial-function-application-1.txr
@@ -0,0 +1,5 @@
+$ txr -p "(mapcar (op mapcar (op * 2)) (list (range 0 3) (range 2 8 2)))"
+((0 2 4 6) (4 8 12 16))
+
+$ txr -p "(mapcar (op mapcar (op * @1 @1)) (list (range 0 3) (range 2 8 2)))"
+((0 1 4 9) (4 16 36 64))
diff --git a/Task/Partial-function-application/TXR/partial-function-application-2.txr b/Task/Partial-function-application/TXR/partial-function-application-2.txr
new file mode 100644
index 0000000000..06229885b4
--- /dev/null
+++ b/Task/Partial-function-application/TXR/partial-function-application-2.txr
@@ -0,0 +1,11 @@
+$ txr -e "(progn
+ (defun fs (fun seq) (mapcar fun seq))
+ (defun f1 (num) (* 2 num))
+ (defun f2 (num) (* num num))
+ (defvar fsf1 (op fs f1)) ;; pointless: can just be (defun fsf1 (seq) (fs f1 seq)) !!!
+ (defvar fsf2 (op fs f2))
+
+ (print [fs fsf1 '((0 1 2 3) (2 4 6 8))]) (put-line \"\")
+ (print [fs fsf2 '((0 1 2 3) (2 4 6 8))]) (put-line \"\"))"
+((0 2 4 6) (4 8 12 16))
+((0 1 4 9) (4 16 36 64))
diff --git a/Task/Pascals-triangle-Puzzle/D/pascals-triangle-puzzle.d b/Task/Pascals-triangle-Puzzle/D/pascals-triangle-puzzle.d
index a8accd613c..c3b4c1bd5e 100644
--- a/Task/Pascals-triangle-Puzzle/D/pascals-triangle-puzzle.d
+++ b/Task/Pascals-triangle-Puzzle/D/pascals-triangle-puzzle.d
@@ -1,12 +1,13 @@
import std.stdio, std.algorithm;
-void iterate(bool doPrint=true)(double[] v, double[] diff) {
+void iterate(bool doPrint=true)(double[] v, double[] diff)
+/*pure nothrow*/ {
static ref T E(T)(T[] x, in size_t row, in size_t col)
pure nothrow {
return x[row * (row + 1) / 2 + col];
}
- double sum = 0.0;
+ double tot = 0.0;
do {
// enforce boundary conditions
E(v, 0, 0) = 151;
@@ -15,8 +16,8 @@ void iterate(bool doPrint=true)(double[] v, double[] diff) {
E(v, 4, 3) = 4;
// calculate difference from equilibrium
- foreach (i; 1 .. 5) {
- foreach (j; 0 .. i + 1) {
+ foreach (immutable i; 1 .. 5) {
+ foreach (immutable j; 0 .. i + 1) {
E(diff, i, j) = 0;
if (j < i)
E(diff, i, j) += E(v, i - 1, j) -
@@ -29,8 +30,8 @@ void iterate(bool doPrint=true)(double[] v, double[] diff) {
}
}
- foreach (i; 1 .. 4)
- foreach (j; 0 .. i)
+ foreach (immutable i; 1 .. 4)
+ foreach (immutable j; 0 .. i)
E(diff, i, j) += E(v, i + 1, j) +
E(v, i + 1, j + 1) -
E(v, i, j);
@@ -40,22 +41,22 @@ void iterate(bool doPrint=true)(double[] v, double[] diff) {
// do feedback, check if we are close enough
// 4: scale down the feedback to avoid oscillations
v[] += diff[] / 4;
- sum = reduce!q{a + b ^^ 2}(0.0, diff);
+ tot = diff.map!q{ a ^^ 2 }.sum;
static if (doPrint)
- writeln("dev: ", sum);
+ writeln("dev: ", tot);
- // sum(dx^2) < 0.1 means each cell is no more than 0.5 away
+ // tot(dx^2) < 0.1 means each cell is no more than 0.5 away
// from equilibrium. It takes about 50 iterations. After
- // 700 iterations sum is < 1e-25, but that's overkill.
- } while (sum >= 0.1);
+ // 700 iterations tot is < 1e-25, but that's overkill.
+ } while (tot >= 0.1);
}
void main() {
- static void show(in double[] x) {
+ static void show(in double[] x) nothrow {
int idx;
- foreach (i; 0 .. 5)
- foreach (j; 0 .. i+1) {
+ foreach (immutable i; 0 .. 5)
+ foreach (immutable j; 0 .. i+1) {
printf("%4d%c", cast(int)(0.5 + x[idx]),
j < i ? ' ' : '\n');
idx++;
diff --git a/Task/Pascals-triangle/AutoHotkey/pascals-triangle.ahk b/Task/Pascals-triangle/AutoHotkey/pascals-triangle-1.ahk
similarity index 100%
rename from Task/Pascals-triangle/AutoHotkey/pascals-triangle.ahk
rename to Task/Pascals-triangle/AutoHotkey/pascals-triangle-1.ahk
diff --git a/Task/Pascals-triangle/AutoHotkey/pascals-triangle-2.ahk b/Task/Pascals-triangle/AutoHotkey/pascals-triangle-2.ahk
new file mode 100644
index 0000000000..191785ece3
--- /dev/null
+++ b/Task/Pascals-triangle/AutoHotkey/pascals-triangle-2.ahk
@@ -0,0 +1,25 @@
+Msgbox % format(pascalstriangle())
+Return
+
+format(o) ; converts object to string
+{
+ For k, v in o
+ s .= IsObject(v) ? format(v) "`n" : v " "
+ Return s
+}
+pascalstriangle(n=7) ; n rows of Pascal's triangle
+{
+ p := Object(), z:=Object()
+ Loop, % n
+ Loop, % row := A_Index
+ col := A_Index
+ , p[row, col] := row = 1 and col = 1
+ ? 1
+ : (p[row-1, col-1] = "" ; math operations on blanks return blanks; I want to assume zero
+ ? 0
+ : p[row-1, col-1])
+ + (p[row-1, col] = ""
+ ? 0
+ : p[row-1, col])
+ Return p
+}
diff --git a/Task/Pascals-triangle/TI-83-BASIC/pascals-triangle-1.ti-83 b/Task/Pascals-triangle/TI-83-BASIC/pascals-triangle-1.ti-83
new file mode 100644
index 0000000000..8eb8f36c16
--- /dev/null
+++ b/Task/Pascals-triangle/TI-83-BASIC/pascals-triangle-1.ti-83
@@ -0,0 +1,17 @@
+PROGRAM:PASCALTR
+:Lbl IN
+:ClrHome
+:Disp "NUMBER OF ROWS"
+:Input N
+:If N < 1:Goto IN
+:{N,N}→dim([A])
+:"CHEATING TO MAKE IT FASTER"
+:For(I,1,N)
+:1→[A](1,1)
+:End
+:For(I,2,N)
+:For(J,2,I)
+:[A](I-1,J-1)+[A](I-1,J)→[A](I,J)
+:End
+:End
+:[A]
diff --git a/Task/Pascals-triangle/TI-83-BASIC/pascals-triangle-2.ti-83 b/Task/Pascals-triangle/TI-83-BASIC/pascals-triangle-2.ti-83
new file mode 100644
index 0000000000..60a2d3944d
--- /dev/null
+++ b/Task/Pascals-triangle/TI-83-BASIC/pascals-triangle-2.ti-83
@@ -0,0 +1,13 @@
+PROGRAM:PASCALTR
+:Lbl IN
+:ClrHome
+:Disp "NUMBER OF ROWS"
+:Input N
+:If N < 1:Goto IN
+:{N,N}→dim([A])
+:For(I,2,N)
+:For(J,2,I)
+:(I-1) nCr (J-1)→[A](I,J)
+:End
+:End
+:[A]
diff --git a/Task/Perfect-numbers/D/perfect-numbers-1.d b/Task/Perfect-numbers/D/perfect-numbers-1.d
index 07dbfe3564..fc9d03723b 100644
--- a/Task/Perfect-numbers/D/perfect-numbers-1.d
+++ b/Task/Perfect-numbers/D/perfect-numbers-1.d
@@ -1,21 +1,12 @@
-import std.stdio, std.math, std.range, std.algorithm;
+import std.stdio, std.algorithm, std.range;
-bool isPerfectNumber(in int n) pure nothrow {
- if (n < 2)
- return false;
-
- int sum = 1;
- foreach (immutable i; 2 .. cast(int)sqrt(cast(real)n) + 1)
- if (n % i == 0) {
- immutable int q = n / i;
- sum += i;
- if (q > i)
- sum += q;
- }
-
- return sum == n;
+bool isPerfectNumber1(in uint n) pure nothrow
+in {
+ assert(n > 0);
+} body {
+ return n == iota(1, n - 1).filter!(i => n % i == 0).sum;
}
void main() {
- 10_000.iota.filter!isPerfectNumber.writeln;
+ iota(1, 10_000).filter!isPerfectNumber1.writeln;
}
diff --git a/Task/Perfect-numbers/D/perfect-numbers-2.d b/Task/Perfect-numbers/D/perfect-numbers-2.d
index 91ac976953..f7c9a113be 100644
--- a/Task/Perfect-numbers/D/perfect-numbers-2.d
+++ b/Task/Perfect-numbers/D/perfect-numbers-2.d
@@ -1,12 +1,21 @@
-import std.stdio, std.algorithm, std.range;
+import std.stdio, std.math, std.range, std.algorithm;
-bool isPerfect(in uint n) pure nothrow
-in {
- assert(n > 0);
-} body {
- return n == reduce!((s, i) => n % i ? s : s + i)(0, iota(1, n-1));
+bool isPerfectNumber2(in int n) pure nothrow {
+ if (n < 2)
+ return false;
+
+ int total = 1;
+ foreach (immutable i; 2 .. cast(int)real(n).sqrt + 1)
+ if (n % i == 0) {
+ immutable int q = n / i;
+ total += i;
+ if (q > i)
+ total += q;
+ }
+
+ return total == n;
}
void main() {
- iota(1, 10_000).filter!isPerfect.writeln;
+ 10_000.iota.filter!isPerfectNumber2.writeln;
}
diff --git a/Task/Perfect-numbers/Dart/perfect-numbers-1.dart b/Task/Perfect-numbers/Dart/perfect-numbers-1.dart
new file mode 100644
index 0000000000..175896da0f
--- /dev/null
+++ b/Task/Perfect-numbers/Dart/perfect-numbers-1.dart
@@ -0,0 +1,23 @@
+/*
+ * Function to test if a number is a perfect number
+ * A number is a perfect number if it is equal to the sum of all its divisors
+ * Input: Positive integer n
+ * Output: true if n is a perfect number, false otherwise
+ */
+bool isPerfect(int n){
+ //Generate a list of integers in the range 1 to n-1 : [1, 2, ..., n-1]
+ List1. 772 - Tcl - 2. 733 - Racket - 3. 718 - Python - 4. 685 - C - 5. 657 - Perl 6 - 6. 654 - J - 7. 645 - D - 8. 643 - Ruby - 9. 636 - PicoLisp - 10. 624 - Go - 11. 610 - Perl - 12. 579 - REXX - 13. 578 - Ada - 14. 567 - Mathematica - 15. 567 - Haskell - 16. 532 - Unicon - 17. 526 - Java - 18. 522 - BBC BASIC - 19. 489 - OCaml - 20. 487 - Icon - 21. 477 - C++ - 22. 470 - PureBasic - 23. 448 - Common Lisp - 24. 439 - Erlang - 25. 439 - C sharp - 26. 437 - AutoHotkey - 27. 406 - Scala - 28. 382 - JavaScript - 29. 375 - Clojure - 30. 356 - Seed7 - 31. 342 - Lua - 32. 339 - R - 33. 337 - Groovy - 34. 334 - PHP - 35. 333 - F Sharp - 36. 329 - Forth - 37. 328 - ALGOL 68 - 38. 323 - Fortran - 39. 312 - Pascal +1. 797 - Tcl + 2. 756 - Racket + 3. 750 - Python + 4. 719 - C + 5. 692 - Perl 6 + 6. 678 - D + 7. 677 - J + 8. 668 - Ruby + 9. 638 - Go + 10. 636 - PicoLisp + 11. 630 - Perl + 12. 615 - REXX + 13. 585 - Ada + 14. 578 - Haskell + 15. 567 - Mathematica + 16. 561 - AutoHotkey + 17. 541 - Unicon + 18. 539 - Java + 19. 525 - BBC BASIC + 20. 495 - Icon + 21. 492 - OCaml + 22. 487 - C++ + 23. 473 - Common Lisp + 24. 469 - PureBasic + 25. 446 - C sharp + 26. 444 - Erlang + 27. 411 - Scala + 28. 387 - JavaScript + 29. 385 - Clojure + 30. 359 - Seed7 + 31. 347 - Lua + 32. 341 - Groovy + 33. 340 - R + 34. 340 - F Sharp + 35. 337 - Forth + 36. 335 - PHP + 37. 329 - ALGOL 68 + 38. 328 - Fortran + 39. 319 - Pascal 40. 307 - Liberty BASIC ...-A complete ranked listing of all '''505''' languages (from the REXX example) is included here ──► [[RC_POP.OUT]]. +A complete ranked listing of all '''514''' languages (from the REXX example) is included here ──► [[RC_POP.OUT]]. Filtering wrong results is optional. You can check against [[Special:MostLinkedCategories]] diff --git a/Task/Rosetta-Code-Rank-languages-by-popularity/REXX/rosetta-code-rank-languages-by-popularity.rexx b/Task/Rosetta-Code-Rank-languages-by-popularity/REXX/rosetta-code-rank-languages-by-popularity.rexx index ccb563d7ef..4e3240ecf5 100644 --- a/Task/Rosetta-Code-Rank-languages-by-popularity/REXX/rosetta-code-rank-languages-by-popularity.rexx +++ b/Task/Rosetta-Code-Rank-languages-by-popularity/REXX/rosetta-code-rank-languages-by-popularity.rexx @@ -69,8 +69,9 @@ old.1='╬£C++' ; new.1= "µC++" /*Unicode ╬£C++ ──►ASCII-8: old.2='UC++' ; new.2= "µC++" /*old UC++ ──►ASCII-8: µC++ */ old.3='╨£╨Ü-' ; new.3= "MK-" /*Unicode ╨£╨Ü- ──►ASCII-8: MK- */ old.4='D├⌐j├á' ; new.4= 'Déjá' /*Unicode ├⌐j├á ──►ASCII-8: Déjá */ -old.5='Cach├⌐' ; new.5= 'Caché' /*Unicode ach├⌐ ──►ASCII-8: Caché*/ -old.6='??-61/52' ; new.6= 'MK-61/52' /*somewhere a mistranslated: MK- */ +old.5='D├⌐j├á' ; new.4= 'Dëjá' /*Unicode ├½j├á ──►ASCII-8: Dëjá */ +old.6='Cach├⌐' ; new.5= 'Caché' /*Unicode ach├⌐ ──►ASCII-8: Caché*/ +old.7='??-61/52' ; new.6= 'MK-61/52' /*somewhere a mistranslated: MK- */ do recs=0 while lines(inFID)\==0 /*read a file, 1 line at a time.*/ $=translate(linein(inFID),,'9'x) /*handle any stray tab characters*/ diff --git a/Task/Rot-13/AutoHotkey/rot-13-4.ahk b/Task/Rot-13/AutoHotkey/rot-13-4.ahk new file mode 100644 index 0000000000..3b5dbef4ee --- /dev/null +++ b/Task/Rot-13/AutoHotkey/rot-13-4.ahk @@ -0,0 +1,9 @@ +Rot13(string) { + Output := "" + Loop, Parse, string + { + a := ~Asc(A_LoopField) + Output .= Chr(~a-1//(~(a|32)//13*2-11)*13) + } + return Output +} diff --git a/Task/Rot-13/Rust/rot-13.rust b/Task/Rot-13/Rust/rot-13.rust new file mode 100644 index 0000000000..44d4dfea16 --- /dev/null +++ b/Task/Rot-13/Rust/rot-13.rust @@ -0,0 +1,17 @@ +fn rot13 (string: ~str) -> ~str { + fn rot13u8 (c: u8) -> u8 { + match c { + 97..109 => c+13, + 65..77 => c+13, + 110..122 => c-13, + 78..90 => c-13, + _ => c + } + } + std::str::from_utf8_owned(string.as_bytes().map(|c| rot13u8(*c))).unwrap() +} + +fn main () { + let a = rot13(~"abc"); + assert_eq!(a, ~"nop"); +} diff --git a/Task/Runtime-evaluation-In-an-environment/TXR/runtime-evaluation-in-an-environment-1.txr b/Task/Runtime-evaluation-In-an-environment/TXR/runtime-evaluation-in-an-environment-1.txr new file mode 100644 index 0000000000..d5ab5f9f72 --- /dev/null +++ b/Task/Runtime-evaluation-In-an-environment/TXR/runtime-evaluation-in-an-environment-1.txr @@ -0,0 +1,5 @@ +(defun eval-subtract-for-two-values-of-x (code-fragment x1 x0) + (- (eval ^(let ((x ,x1)) ,code-fragment)) + (eval ^(let ((x ,x0)) ,code-fragment)))) + +(eval-subtract-for-two-values-of-x 1 2) ;; yields -4.67077427047161 diff --git a/Task/Runtime-evaluation-In-an-environment/TXR/runtime-evaluation-in-an-environment-2.txr b/Task/Runtime-evaluation-In-an-environment/TXR/runtime-evaluation-in-an-environment-2.txr new file mode 100644 index 0000000000..3bf3f1a531 --- /dev/null +++ b/Task/Runtime-evaluation-In-an-environment/TXR/runtime-evaluation-in-an-environment-2.txr @@ -0,0 +1,7 @@ +(defun eval-subtract-for-two-values-of-x (code-fragment x1 x0) + (let ((e1 (make-env (list (cons 'x x1)))) ;; create two environments stuffed with binding for x + (e0 (make-env (list (cons 'x x0))))) + (- (eval code-fragment e1) ;; pass these environment to eval + (eval code-fragment e0)))) + +(eval-subtract-for-two-values-of-x '(exp x) 1 2) diff --git a/Task/Runtime-evaluation-In-an-environment/TXR/runtime-evaluation-in-an-environment-3.txr b/Task/Runtime-evaluation-In-an-environment/TXR/runtime-evaluation-in-an-environment-3.txr new file mode 100644 index 0000000000..1e19a21c21 --- /dev/null +++ b/Task/Runtime-evaluation-In-an-environment/TXR/runtime-evaluation-in-an-environment-3.txr @@ -0,0 +1,9 @@ +(defun eval-subtract-for-two-values-of-x (code-fragment x1 x0) + (let ((e1 (make-env)) + (e0 (make-env))) + (env-vbind e1 'x x1) + (env-vbind e0 'x x0) + (- (eval code-fragment e1) + (eval code-fragment e0)))) + +(eval-subtract-for-two-values-of-x '(exp x) 1 2) diff --git a/Task/Runtime-evaluation-In-an-environment/TXR/runtime-evaluation-in-an-environment-4.txr b/Task/Runtime-evaluation-In-an-environment/TXR/runtime-evaluation-in-an-environment-4.txr new file mode 100644 index 0000000000..618fe32548 --- /dev/null +++ b/Task/Runtime-evaluation-In-an-environment/TXR/runtime-evaluation-in-an-environment-4.txr @@ -0,0 +1,7 @@ +(defvar x) + +(defun eval-subtract-for-two-values-of-x (code-fragment x1 x0) + (- (let ((x x1)) (eval code-fragment)) + (let ((x x0)) (eval code-fragment)))) + +(eval-subtract-for-two-values-of-x '(exp x) 1 2) diff --git a/Task/S-Expressions/AutoHotkey/s-expressions-1.ahk b/Task/S-Expressions/AutoHotkey/s-expressions-1.ahk new file mode 100644 index 0000000000..7d93bd5d6a --- /dev/null +++ b/Task/S-Expressions/AutoHotkey/s-expressions-1.ahk @@ -0,0 +1,16 @@ +S_Expressions(Str){ + Str := RegExReplace(Str, "s)(? " SEDOL(A_LoopField) "`n" +Msgbox %output% + +SEDOL(code) { + Static weight1:=1, weight2:=3, weight3:=1, weight4:=7, weight5:=3, weight6:=9 + If (StrLen(code) != 6) + Return "Invalid length." + StringCaseSense On + Loop, Parse, code + If A_LoopField is Number + check_digit += A_LoopField * weight%A_Index% + Else If A_LoopField in B,C,D,F,G,H,J,K,L,M,N,P,Q,R,S,T,V,W,X,Y,Z + check_digit += (Asc(A_LoopField)-Asc("A") + 10) * weight%A_Index% + Else + Return "Invalid character." + Return code . Mod(10-Mod(check_digit,10),10) +} diff --git a/Task/SEDOLs/AutoHotkey/sedols.ahk b/Task/SEDOLs/AutoHotkey/sedols-2.ahk similarity index 66% rename from Task/SEDOLs/AutoHotkey/sedols.ahk rename to Task/SEDOLs/AutoHotkey/sedols-2.ahk index deedca1445..9c480c7496 100644 --- a/Task/SEDOLs/AutoHotkey/sedols.ahk +++ b/Task/SEDOLs/AutoHotkey/sedols-2.ahk @@ -10,8 +10,8 @@ MsgBox % SEDOL("585284") ;5852842 MsgBox % SEDOL("B0YBKT") ;B0YBKT7 SEDOL(w) { - Static w1:=1,w2:=3,w3:=1,w4:=7,w5:=3,w6:=9 - Loop Parse, w - s += ((c:=Asc(A_LoopField))>=Asc("A") ? c-Asc("A")+10 : c-Asc("0")) * w%A_Index% - Return w mod(10-mod(s,10),10) + static weights := [1,3,1,7,3,9] + loop parse, w + s += ((c := Asc(A_LoopField)) >= 65 ? c - 65 + 10 : c - 48) * weights[A_Index] + return w Mod(10 - Mod(s, 10), 10) } diff --git a/Task/SHA-1/00DESCRIPTION b/Task/SHA-1/00DESCRIPTION index ceae5f0925..371d162e9d 100644 --- a/Task/SHA-1/00DESCRIPTION +++ b/Task/SHA-1/00DESCRIPTION @@ -1,6 +1,6 @@ '''SHA-1''' or '''SHA1''' is a one-way hash function; it computes a 160-bit message digest. SHA-1 often appears in security protocols; for example, many HTTPS websites use RSA with SHA-1 to secure their connections. BitTorrent uses SHA-1 to verify downloads. Git and Mercurial use SHA-1 digests to identify commits. -A US government standard, [http://www.itl.nist.gov/fipspubs/fip180-1.htm FIPS 180-1], defines SHA-1. +A US government standard, [[SHA-1/FIPS-180-1|FIPS 180-1]], defines SHA-1. Find the SHA-1 message digest for a string of [[octet]]s. You may either call a SHA-1 library, or implement SHA-1 in your language. Both approaches interest Rosetta Code. diff --git a/Task/SHA-1/J/sha-1-1.j b/Task/SHA-1/J/sha-1-1.j new file mode 100644 index 0000000000..01f71a244f --- /dev/null +++ b/Task/SHA-1/J/sha-1-1.j @@ -0,0 +1,35 @@ +pad=: ,1,(0#~512 | [: - 65 + #),(64#2)#:# + +f=:4 :0 + 'B C D'=: _32 ]\ y + if. x < 20 do. + (B*C)+.D>B + elseif. x < 40 do. + B~:C~:D + elseif. x < 60 do. + (B*C)+.(B*D)+.C*D + elseif. x < 80 do. + B~:C~:D + end. +) + +K=: ((32#2) #: 16b5a827999 16b6ed9eba1 16b8f1bbcdc 16bca62c1d6) {~ <.@%&20 + +plus=:+&.((32#2).) + +process=:3 :0 + H=. #: 16b67452301 16befcdab89 16b98badcfe 16b10325476 16bc3d2e1f0 + W=. (, [: , 1 |."#. _3 _8 _14 _16 ~:/@:{ ])^:64 y ]\~ _32 + 'A B C D E'=. H + for_t. i.80 do. + TEMP=. (5|.A) plus (t f B,C,D) plus E plus (W{~t) plus K t + E=. D + D=. C + C=. 30 |. B + B=. A + A=. TEMP + end. + ,H plus A,B,C,D,:E +) + +sha1=: _512 process\ pad diff --git a/Task/SHA-1/J/sha-1-2.j b/Task/SHA-1/J/sha-1-2.j new file mode 100644 index 0000000000..8d9e939b0a --- /dev/null +++ b/Task/SHA-1/J/sha-1-2.j @@ -0,0 +1,5 @@ + text2bits=: (8#2) ,@:#: a. i. ] + bits2hex=: '0123456789abcdef' {~ _4 #.\ , + + bits2hex sha1 text2bits 'Rosetta Code' +48c98f7e5a6e736d790ab740dfc3f51a61abe2b5 diff --git a/Task/SHA-1/J/sha-1-3.j b/Task/SHA-1/J/sha-1-3.j new file mode 100644 index 0000000000..efb47272df --- /dev/null +++ b/Task/SHA-1/J/sha-1-3.j @@ -0,0 +1,42 @@ +text2bits=: (8#2) ,@:#: a. i. ] +words2bits=: ,@:((32#2):) + +pad=: _32 #.\ (, 1,(0#~512 | [: - 65 + #),(64#2)#:#) +lim32=: 2^32 +rot32=: (] lim32&|@* 2 ^ [) + ] <.@% 2 ^ 32- [ +and=: 17 b. +notimplies=: 18 b. +xor=: 22 b. +or=: 23 b. + +f=:4 :0 + 'B C D'=: y + if. x < 20 do. + (B and C) or D notimplies B + elseif. x < 40 do. + B xor C xor D + elseif. x < 60 do. + (B and C) or (B and D) or C and D + elseif. x < 80 do. + B xor C xor D + end. +) + +K=: 16b5a827999 16b6ed9eba1 16b8f1bbcdc 16bca62c1d6 {~ <.@%&20 + +process=:3 :0 + H=. 16b67452301 16befcdab89 16b98badcfe 16b10325476 16bc3d2e1f0 + W=. (, [: , 1 rot32 _3 _8 _14 _16 xor/@:{ ])^:64 y + 'A B C D E'=. H + for_t. i.80 do. + TEMP=. lim32|(5 rot32 A) + (t f B,C,D) + E + (W{~t) + K t + E=. D + D=. C + C=. 30 rot32 B + B=. A + A=. TEMP + end. + ,lim32|H + A,B,C,D,E +) + +sha1=: _16 process\ pad diff --git a/Task/SHA-1/J/sha-1-4.j b/Task/SHA-1/J/sha-1-4.j new file mode 100644 index 0000000000..7d4c645a0c --- /dev/null +++ b/Task/SHA-1/J/sha-1-4.j @@ -0,0 +1,8 @@ +words2hex=: '0123456789abcdef' {~ (8#16): + + words2hex sha1 text2bits 'Rosetta Code' +48c98f7e +5a6e736d +790ab740 +dfc3f51a +61abe2b5 diff --git a/Task/SHA-1/Lua/sha-1.lua b/Task/SHA-1/Lua/sha-1.lua new file mode 100644 index 0000000000..aac860983e --- /dev/null +++ b/Task/SHA-1/Lua/sha-1.lua @@ -0,0 +1,7 @@ +#!/usr/bin/lua + +local sha1 = require "sha1" + +for i, str in ipairs{"Rosetta code", "Rosetta Code"} do + print(string.format("SHA-1(%q) = %s", str, sha1(str))) +end diff --git a/Task/SHA-1/Octave/sha-1.octave b/Task/SHA-1/Octave/sha-1.octave new file mode 100644 index 0000000000..71c26d4598 --- /dev/null +++ b/Task/SHA-1/Octave/sha-1.octave @@ -0,0 +1 @@ +sprintf("%02x", SHA1(+"Rosetta Code"(:))) diff --git a/Task/SHA-1/PowerShell/sha-1.psh b/Task/SHA-1/PowerShell/sha-1.psh new file mode 100644 index 0000000000..06414aeafc --- /dev/null +++ b/Task/SHA-1/PowerShell/sha-1.psh @@ -0,0 +1,11 @@ +Function Calculate-SHA1( $String ){ + $Enc = [system.Text.Encoding]::UTF8 + $Data = $enc.GetBytes($String) + + # Create a New SHA1 Crypto Provider + $Sha = New-Object System.Security.Cryptography.SHA1CryptoServiceProvider + + # Now hash and display results + $Result = $sha.ComputeHash($Data) + [System.Convert]::ToBase64String($Result) +} diff --git a/Task/SHA-256/Common-Lisp/sha-256.lisp b/Task/SHA-256/Common-Lisp/sha-256.lisp new file mode 100644 index 0000000000..168c3370ae --- /dev/null +++ b/Task/SHA-256/Common-Lisp/sha-256.lisp @@ -0,0 +1,7 @@ +(ql:quickload 'ironclad) +(defun sha-256 (str) + (ironclad:byte-array-to-hex-string + (ironclad:digest-sequence :sha256 + (ironclad:ascii-string-to-byte-array str)))) + +(sha-256 "Rosetta code") diff --git a/Task/SHA-256/D/sha-256.d b/Task/SHA-256/D/sha-256.d new file mode 100644 index 0000000000..6988d93211 --- /dev/null +++ b/Task/SHA-256/D/sha-256.d @@ -0,0 +1,350 @@ +// Copyright (C) 2005, 2006 Free Software Foundation, Inc. GNU License. +// Translated to D language. Only lightly tested, not for serious use. + +import core.stdc.string: memcpy; +import core.bitop: bswap; + +struct SHA256 { + enum uint BLOCK_SIZE = 4096; + static assert(BLOCK_SIZE % 64 == 0, "Invalid BLOCK_SIZE."); + + uint[8] state; + uint[2] total; + uint bufLen; + union { + uint[32] buffer; + ubyte[buffer.sizeof] bufferB; + } + + alias TResult = ubyte[256 / 8]; + + version(WORDS_BIGENDIAN) { + static uint bswap(in uint n) pure nothrow { return n; } + } + + // Bytes used to pad the buffer to the next 64-byte boundary. + static immutable ubyte[64] fillBuf = [0x80, 0 /* , 0, 0, ... */]; + + + /** Initialize structure containing state of computation. + Takes a pointer to a 256 bit block of data (eight 32 bit ints) and + intializes it to the start constants of the SHA256 algorithm. This + must be called before using hash in the call to sha256_hash. */ + void init() pure nothrow { + state = [0x6a09e667U, 0xbb67ae85U, 0x3c6ef372U, 0xa54ff53aU, + 0x510e527fU, 0x9b05688cU, 0x1f83d9abU, 0x5be0cd19U]; + total[] = 0; + bufLen = 0; + } + + + /** Starting with the result of former calls of this function (or + the initialization function) update the context for the next LEN + bytes starting at BUFFER. + It is not required that LEN is a multiple of 64. */ + void processBytes(in ubyte[] inBuffer) pure nothrow { + // When we already have some bits in our internal + // buffer concatenate both inputs first. + const(ubyte)* inBufferPtr = inBuffer.ptr; + auto len = inBuffer.length; + + if (bufLen != 0) { + immutable size_t left_over = bufLen; + immutable size_t add = (128 - left_over > len) ? + len : + 128 - left_over; + + memcpy(&bufferB[left_over], inBufferPtr, add); + bufLen += add; + + if (bufLen > 64) { + processBlock(bufferB[0 .. bufLen & ~63]); + + bufLen &= 63; + // The regions in the following copy operation + // cannot overlap. + memcpy(bufferB.ptr, + &bufferB[(left_over + add) & ~63], bufLen); + } + + inBufferPtr += add; + len -= add; + } + + // Process available complete blocks. + if (len >= 64) { + processBlock(inBufferPtr[0 .. len & ~63]); + inBufferPtr += (len & ~63); + len &= 63; + } + + // Move remaining bytes in internal buffer. + if (len > 0) { + size_t left_over = bufLen; + + memcpy(&bufferB[left_over], inBufferPtr, len); + left_over += len; + if (left_over >= 64) { + processBlock(bufferB[0 .. 64]); + left_over -= 64; + memcpy(bufferB.ptr, &bufferB[64], left_over); + } + bufLen = left_over; + } + } + + + /** Starting with the result of former calls of this function + (or the initialization function) update the context ctx for + the next len bytes starting at buffer. + It is necessary that len is a multiple of 64. */ + void processBlock(in ubyte[] inBuffer) + pure nothrow in { + assert(inBuffer.length % 64 == 0); + } body { + // Round functions. + static uint F1(in uint e, in uint f, in uint g) pure nothrow { + return g ^ (e & (f ^ g)); + } + + static uint F2(in uint a, in uint b, in uint c) pure nothrow { + return (a & b) | (c & (a | b)); + } + + immutable len = inBuffer.length; + auto words = cast(uint*)inBuffer.ptr; + immutable size_t nWords = len / uint.sizeof; + const uint* endp = words + nWords; + uint[16] x = void; + auto a = state[0]; + auto b = state[1]; + auto c = state[2]; + auto d = state[3]; + auto e = state[4]; + auto f = state[5]; + auto g = state[6]; + auto h = state[7]; + + // First increment the byte count. FIPS PUB 180-2 specifies the + // possible length of the file up to 2^64 bits. Here we only + // compute the number of bytes. Do a double word increment. + total[0] += len; + if (total[0] < len) + total[1]++; + + static uint rol(in uint x, in uint n) pure nothrow { + return (x << n) | (x >> (32 - n)); } + static uint S0(in uint x) pure nothrow { + return rol(x, 25) ^ rol(x, 14) ^ (x >> 3); } + static uint S1(in uint x) pure nothrow { + return rol(x, 15) ^ rol(x, 13) ^ (x >> 10); } + static uint SS0(in uint x) pure nothrow { + return rol(x, 30) ^ rol(x,19) ^ rol(x, 10); } + static uint SS1(in uint x) pure nothrow { + return rol(x, 26) ^ rol(x, 21) ^ rol(x, 7); } + + uint M(in uint I) nothrow { + immutable uint tm = S1(x[(I - 2) & 0x0f]) + + x[(I - 7) & 0x0f] + + S0(x[(I - 15) & 0x0f]) + + x[I & 0x0f]; + x[I & 0x0f] = tm; + return tm; + } + + static void R(in uint a, in uint b, in uint c, ref uint d, + in uint e, in uint f, in uint g, ref uint h, + in uint k, in uint m) pure nothrow { + immutable t0 = SS0(a) + F2(a, b, c); + immutable t1 = h + SS1(e) + F1(e, f, g) + k + m; + d += t1; + h = t0 + t1; + } + + // SHA256 round constants. + static immutable uint[64] K = [ + 0x428a2f98U, 0x71374491U, 0xb5c0fbcfU, 0xe9b5dba5U, + 0x3956c25bU, 0x59f111f1U, 0x923f82a4U, 0xab1c5ed5U, + 0xd807aa98U, 0x12835b01U, 0x243185beU, 0x550c7dc3U, + 0x72be5d74U, 0x80deb1feU, 0x9bdc06a7U, 0xc19bf174U, + 0xe49b69c1U, 0xefbe4786U, 0x0fc19dc6U, 0x240ca1ccU, + 0x2de92c6fU, 0x4a7484aaU, 0x5cb0a9dcU, 0x76f988daU, + 0x983e5152U, 0xa831c66dU, 0xb00327c8U, 0xbf597fc7U, + 0xc6e00bf3U, 0xd5a79147U, 0x06ca6351U, 0x14292967U, + 0x27b70a85U, 0x2e1b2138U, 0x4d2c6dfcU, 0x53380d13U, + 0x650a7354U, 0x766a0abbU, 0x81c2c92eU, 0x92722c85U, + 0xa2bfe8a1U, 0xa81a664bU, 0xc24b8b70U, 0xc76c51a3U, + 0xd192e819U, 0xd6990624U, 0xf40e3585U, 0x106aa070U, + 0x19a4c116U, 0x1e376c08U, 0x2748774cU, 0x34b0bcb5U, + 0x391c0cb3U, 0x4ed8aa4aU, 0x5b9cca4fU, 0x682e6ff3U, + 0x748f82eeU, 0x78a5636fU, 0x84c87814U, 0x8cc70208U, + 0x90befffaU, 0xa4506cebU, 0xbef9a3f7U, 0xc67178f2U]; + + while (words < endp) { + foreach (ref xi; x) { + xi = bswap(*words); + words++; + } + + R(a, b, c, d, e, f, g, h, K[ 0], x[ 0]); + R(h, a, b, c, d, e, f, g, K[ 1], x[ 1]); + R(g, h, a, b, c, d, e, f, K[ 2], x[ 2]); + R(f, g, h, a, b, c, d, e, K[ 3], x[ 3]); + R(e, f, g, h, a, b, c, d, K[ 4], x[ 4]); + R(d, e, f, g, h, a, b, c, K[ 5], x[ 5]); + R(c, d, e, f, g, h, a, b, K[ 6], x[ 6]); + R(b, c, d, e, f, g, h, a, K[ 7], x[ 7]); + R(a, b, c, d, e, f, g, h, K[ 8], x[ 8]); + R(h, a, b, c, d, e, f, g, K[ 9], x[ 9]); + R(g, h, a, b, c, d, e, f, K[10], x[10]); + R(f, g, h, a, b, c, d, e, K[11], x[11]); + R(e, f, g, h, a, b, c, d, K[12], x[12]); + R(d, e, f, g, h, a, b, c, K[13], x[13]); + R(c, d, e, f, g, h, a, b, K[14], x[14]); + R(b, c, d, e, f, g, h, a, K[15], x[15]); + R(a, b, c, d, e, f, g, h, K[16], M(16)); + R(h, a, b, c, d, e, f, g, K[17], M(17)); + R(g, h, a, b, c, d, e, f, K[18], M(18)); + R(f, g, h, a, b, c, d, e, K[19], M(19)); + R(e, f, g, h, a, b, c, d, K[20], M(20)); + R(d, e, f, g, h, a, b, c, K[21], M(21)); + R(c, d, e, f, g, h, a, b, K[22], M(22)); + R(b, c, d, e, f, g, h, a, K[23], M(23)); + R(a, b, c, d, e, f, g, h, K[24], M(24)); + R(h, a, b, c, d, e, f, g, K[25], M(25)); + R(g, h, a, b, c, d, e, f, K[26], M(26)); + R(f, g, h, a, b, c, d, e, K[27], M(27)); + R(e, f, g, h, a, b, c, d, K[28], M(28)); + R(d, e, f, g, h, a, b, c, K[29], M(29)); + R(c, d, e, f, g, h, a, b, K[30], M(30)); + R(b, c, d, e, f, g, h, a, K[31], M(31)); + R(a, b, c, d, e, f, g, h, K[32], M(32)); + R(h, a, b, c, d, e, f, g, K[33], M(33)); + R(g, h, a, b, c, d, e, f, K[34], M(34)); + R(f, g, h, a, b, c, d, e, K[35], M(35)); + R(e, f, g, h, a, b, c, d, K[36], M(36)); + R(d, e, f, g, h, a, b, c, K[37], M(37)); + R(c, d, e, f, g, h, a, b, K[38], M(38)); + R(b, c, d, e, f, g, h, a, K[39], M(39)); + R(a, b, c, d, e, f, g, h, K[40], M(40)); + R(h, a, b, c, d, e, f, g, K[41], M(41)); + R(g, h, a, b, c, d, e, f, K[42], M(42)); + R(f, g, h, a, b, c, d, e, K[43], M(43)); + R(e, f, g, h, a, b, c, d, K[44], M(44)); + R(d, e, f, g, h, a, b, c, K[45], M(45)); + R(c, d, e, f, g, h, a, b, K[46], M(46)); + R(b, c, d, e, f, g, h, a, K[47], M(47)); + R(a, b, c, d, e, f, g, h, K[48], M(48)); + R(h, a, b, c, d, e, f, g, K[49], M(49)); + R(g, h, a, b, c, d, e, f, K[50], M(50)); + R(f, g, h, a, b, c, d, e, K[51], M(51)); + R(e, f, g, h, a, b, c, d, K[52], M(52)); + R(d, e, f, g, h, a, b, c, K[53], M(53)); + R(c, d, e, f, g, h, a, b, K[54], M(54)); + R(b, c, d, e, f, g, h, a, K[55], M(55)); + R(a, b, c, d, e, f, g, h, K[56], M(56)); + R(h, a, b, c, d, e, f, g, K[57], M(57)); + R(g, h, a, b, c, d, e, f, K[58], M(58)); + R(f, g, h, a, b, c, d, e, K[59], M(59)); + R(e, f, g, h, a, b, c, d, K[60], M(60)); + R(d, e, f, g, h, a, b, c, K[61], M(61)); + R(c, d, e, f, g, h, a, b, K[62], M(62)); + R(b, c, d, e, f, g, h, a, K[63], M(63)); + + a = state[0] += a; + b = state[1] += b; + c = state[2] += c; + d = state[3] += d; + e = state[4] += e; + f = state[5] += f; + g = state[6] += g; + h = state[7] += h; + } + } + + + /** Process the remaining bytes in the internal buffer and the + usual prolog according to the standard and write the result to + resBuf. + Important: On some systems it is required that resBuf is correctly + aligned for a 32-bit value. */ + void conclude() pure nothrow { + // Take yet unprocessed bytes into account. + immutable bytes = bufLen; + immutable size_t size = (bytes < 56) ? 64 / 4 : 64 * 2 / 4; + + // Now count remaining bytes. + total[0] += bytes; + if (total[0] < bytes) + total[1]++; + + // Put the 64-bit file length in *bits* at the end of + // the buffer. + buffer[size - 2] = bswap((total[1] << 3) | (total[0] >> 29)); + buffer[size - 1] = bswap(total[0] << 3); + + memcpy(&bufferB[bytes], fillBuf.ptr, (size - 2) * 4 - bytes); + + // Process last bytes. + processBlock(bufferB[0 .. size * 4]); + } + + + /** Put result from this in first 32 bytes following resBuf. The + result must be in little endian byte order. + Important: On some systems it is required that resBuf is correctly + aligned for a 32-bit value. */ + ref TResult read(ref TResult resBuf) const pure nothrow { + foreach (immutable i, immutable s; state) + (cast(uint*)resBuf.ptr)[i] = bswap(s); + return resBuf; + } + + + /** Process the remaining bytes in the buffer and put result from + CTX in first 32 (28) bytes following resBuf. The result is always + in little endian byte order, so that a byte-wise output yields to + the wanted ASCII representation of the message digest. + Important: On some systems it is required that resBuf be correctly + aligned for a 32 bits value. */ + ref TResult finish(ref TResult resBuf) pure nothrow { + conclude; + return read(resBuf); + } + + + /** Compute SHA512 message digest for LEN bytes beginning at + buffer. The result is always in little endian byte order, so that + a byte-wise output yields to the wanted ASCII representation of + the message digest. */ + static ref TResult digest(in ubyte[] inBuffer, ref TResult resBuf) + pure nothrow { + SHA256 sha = void; + + // Initialize the computation context. + sha.init; + + // Process whole buffer but last len % 64 bytes. + sha.processBytes(inBuffer); + + // Put result in desired memory area. + return sha.finish(resBuf); + } + + + /// ditto + static TResult digest(in ubyte[] inBuffer) pure nothrow { + align(4) TResult resBuf = void; + return digest(inBuffer, resBuf); + } +} + + +version (sha_256_main) { + void main() { + import std.stdio, std.string; + + immutable data = "Rosetta code".representation; + writefln("%(%02x%)", SHA256.digest(data)); + } +} diff --git a/Task/SHA-256/Lua/sha-256.lua b/Task/SHA-256/Lua/sha-256.lua new file mode 100644 index 0000000000..14863c40b3 --- /dev/null +++ b/Task/SHA-256/Lua/sha-256.lua @@ -0,0 +1,5 @@ +#!/usr/bin/lua + +require "sha2" + +print(sha2.sha256hex("Rosetta code")) diff --git a/Task/SHA-256/Objective-C/sha-256.m b/Task/SHA-256/Objective-C/sha-256.m new file mode 100644 index 0000000000..d949ec0cac --- /dev/null +++ b/Task/SHA-256/Objective-C/sha-256.m @@ -0,0 +1,21 @@ +#import+ +@implementation AppDelegate + +- (void)applicationDidFinishLaunching:(NSNotification *)aNotification { + NSString* key = @"secret"; + NSString* data = @"Message"; + + const char *cKey = [key cStringUsingEncoding:NSASCIIStringEncoding]; + const char *cData = [data cStringUsingEncoding:NSASCIIStringEncoding]; + unsigned char cHMAC[CC_SHA256_DIGEST_LENGTH]; + CCHmac(kCCHmacAlgSHA256, cKey, strlen(cKey), cData, strlen(cData), cHMAC); + + NSMutableString* result = [NSMutableString stringWithCapacity:(CC_SHA256_DIGEST_LENGTH * 2)]; + + for(CC_LONG i = 0; i < CC_SHA256_DIGEST_LENGTH; i++) + [result appendFormat:@"%02x", cHMAC[i]]; + + NSLog(@"Sha-256: %@", result); + +} diff --git a/Task/Safe-addition/AutoHotkey/safe-addition.ahk b/Task/Safe-addition/AutoHotkey/safe-addition.ahk new file mode 100644 index 0000000000..845e9efc70 --- /dev/null +++ b/Task/Safe-addition/AutoHotkey/safe-addition.ahk @@ -0,0 +1,14 @@ +Msgbox % IntervalAdd(1,2) ; [2.999999,3.000001] + +SetFormat, FloatFast, 0.20 +Msgbox % IntervalAdd(1,2) ; [2.99999999999999910000,3.00000000000000090000] + +;In v1.0.48+, floating point variables have about 15 digits of precision internally +;unless SetFormat Float (i.e. the slow mode) is present anywhere in the script. +;In that case, the stored precision of floating point numbers is determined by A_FormatFloat. +;As there is no way for this function to know whether this is the case or not, +;it conservatively uses A_FormatFloat in all cases. +IntervalAdd(a,b){ + err:=0.1**(SubStr(A_FormatFloat,3) > 15 ? 15 : SubStr(A_FormatFloat,3)) + Return "[" a+b-err ","a+b+err "]" +} diff --git a/Task/Same-Fringe/Clojure/same-fringe-3.clj b/Task/Same-Fringe/Clojure/same-fringe-3.clj index a65537c0d9..38be1c76e7 100644 --- a/Task/Same-Fringe/Clojure/same-fringe-3.clj +++ b/Task/Same-Fringe/Clojure/same-fringe-3.clj @@ -2,7 +2,5 @@ (cond (and (empty? s1) (empty? s2)) true (not= (empty? s1) (empty? s2)) false - :else - (if (= (first s1) (first s2)) - (recur (rest s1) (rest s2)) - false))) + (= (first s1) (first s2)) (recur (rest s1) (rest s2)) + :else false)) diff --git a/Task/Scope-modifiers/Bracmat/scope-modifiers-1.bracmat b/Task/Scope-modifiers/Bracmat/scope-modifiers-1.bracmat new file mode 100644 index 0000000000..325e790049 --- /dev/null +++ b/Task/Scope-modifiers/Bracmat/scope-modifiers-1.bracmat @@ -0,0 +1,13 @@ + 67:?x {x has global scope} +& 77:?y { y has global scope } +& ( double + = + . !y+!y { y refers to the variable declared in myFunc, which + shadows the global variable with the same name } + ) +& ( myFunc + = y,z { y and z have dynamic scope. z is never used. } + . !arg:?y { arg is dynamically scoped } + & double$ + & !x+!y + ) diff --git a/Task/Scope-modifiers/Bracmat/scope-modifiers-2.bracmat b/Task/Scope-modifiers/Bracmat/scope-modifiers-2.bracmat new file mode 100644 index 0000000000..b716b37d25 --- /dev/null +++ b/Task/Scope-modifiers/Bracmat/scope-modifiers-2.bracmat @@ -0,0 +1 @@ +/(x./(y.x$+y$)) { x and y have lexical scope } diff --git a/Task/Search-a-list/Maxima/search-a-list-1.maxima b/Task/Search-a-list/Maxima/search-a-list-1.maxima new file mode 100644 index 0000000000..8a52882fae --- /dev/null +++ b/Task/Search-a-list/Maxima/search-a-list-1.maxima @@ -0,0 +1,9 @@ +haystack: ["Zig","Zag","Wally","Ronald","Bush","Zig","Zag","Krusty","Charlie","Bush","Bozo"]; +needle: "Zag"; + +findneedle(needle, haystack, [opt]):=block([idx], + idx: sublist_indices(haystack, lambda([w], w=needle)), + if emptyp(idx) then throw('notfound), + if emptyp(opt) then return(idx), + opt: first(opt), + if opt='f then first(idx) else if opt='l then last(idx) else throw('unknownmode)); diff --git a/Task/Search-a-list/Maxima/search-a-list-2.maxima b/Task/Search-a-list/Maxima/search-a-list-2.maxima new file mode 100644 index 0000000000..0c0d8e7da1 --- /dev/null +++ b/Task/Search-a-list/Maxima/search-a-list-2.maxima @@ -0,0 +1,12 @@ +(%i32) catch(findneedle("Zag", haystack, 'f)); +(%o32) 2 +(%i33) catch(findneedle("Zag", haystack, 'l)); +(%o33) 7 +(%i34) catch(findneedle("Washington", haystack)); +(%o34) notfound +(%i35) catch(findneedle("Bush", haystack, 'f)); +(%o35) 5 +(%i36) catch(findneedle("Zag", haystack)); +(%o36) [2, 7] +(%i37) catch(findneedle("Zag", haystack, 'l)); +(%o37) 7 diff --git a/Task/Search-a-list/Objective-C/search-a-list.m b/Task/Search-a-list/Objective-C/search-a-list.m new file mode 100644 index 0000000000..484545aa8b --- /dev/null +++ b/Task/Search-a-list/Objective-C/search-a-list.m @@ -0,0 +1,8 @@ +NSArray *haystack = @[@"Zig",@"Zag",@"Wally",@"Ronald",@"Bush",@"Krusty",@"Charlie",@"Bush",@"Bozo"]; +for (id needle in @[@"Washington",@"Bush"]) { + int index = [haystack indexOfObject:needle]; + if (index == NSNotFound) + NSLog(@"%@ is not in haystack", needle); + else + NSLog(@"%i %@", index, needle); +} diff --git a/Task/Self-describing-numbers/ALGOL-68/self-describing-numbers.alg b/Task/Self-describing-numbers/ALGOL-68/self-describing-numbers.alg new file mode 100644 index 0000000000..14de074b25 --- /dev/null +++ b/Task/Self-describing-numbers/ALGOL-68/self-describing-numbers.alg @@ -0,0 +1,46 @@ +BEGIN + + # return TRUE if number is self describing, FALSE otherwise # + OP SELFDESCRIBING = ( INT number )BOOL: + BEGIN + + [10]INT counts := ( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ); + INT n := number; + INT digits := 0; + + # count the occurances of each digit # + WHILE + n /= 0 + DO + digits +:= 1; + counts[ ( n MOD 10 ) + 1 ] +:= 1; + n OVERAB 10 + OD; + + # construct the number that the counts would describe, # + # if the number was self describing # + + INT described number := 0; + FOR i TO digits + DO + described number *:= 10; + described number +:= counts[ i ] + OD; + + # if the described number is the input number, # + # it is self describing # + ( number = described number ) + END; # SELFDESCRIBING # + +main: ( + + FOR i TO 100 000 000 + DO + IF SELFDESCRIBING i + THEN + print( ( i, " is self describing", newline ) ) + FI + OD +) + +END diff --git a/Task/Self-describing-numbers/PicoLisp/self-describing-numbers.l b/Task/Self-describing-numbers/PicoLisp/self-describing-numbers.l index 2a0f067234..770f47754d 100644 --- a/Task/Self-describing-numbers/PicoLisp/self-describing-numbers.l +++ b/Task/Self-describing-numbers/PicoLisp/self-describing-numbers.l @@ -1,5 +1,4 @@ (de selfDescribing (N) - (not - (find '((D I) (<> D (cnt = N (circ I)))) - (setq N (mapcar format (chop N))) - (range 0 (length N)) ) ) ) + (fully '((D I) (= D (cnt = N (circ I)))) + (setq N (mapcar format (chop N))) + (range 0 (length N)) ) ) diff --git a/Task/Semordnilap/00DESCRIPTION b/Task/Semordnilap/00DESCRIPTION index 822ad72410..d69ef0389d 100644 --- a/Task/Semordnilap/00DESCRIPTION +++ b/Task/Semordnilap/00DESCRIPTION @@ -1,4 +1,4 @@ -A [http://en.wikipedia.org/wiki/Semordnilap#Semordnilaps semordnilap], is a word (or phrase) that spells a different word (or phrase) backward. "Semordnilap" is a word that itself is a semordnilap. +A '''[[wp:semordnilap|semordnilap]]''' is a word (or phrase) that spells a different word (or phrase) backward. "Semordnilap" is a word that itself is a semordnilap. Example: ''lager'' and ''regal''diff --git a/Task/Semordnilap/AutoHotkey/semordnilap.ahk b/Task/Semordnilap/AutoHotkey/semordnilap.ahk new file mode 100644 index 0000000000..c0cf75c659 --- /dev/null +++ b/Task/Semordnilap/AutoHotkey/semordnilap.ahk @@ -0,0 +1,22 @@ +S := [], M := [] + +FileRead, dict, unixdict.txt +Loop, Parse, dict, `n, `r`n +{ + r := Reverse(A_LoopField) + if (S[r]) + M.Insert(r " / " A_LoopField) + else + S[A_LoopField] := 1 +} + +Loop, 5 + Out .= "`t" M[A_Index] "`n" + +MsgBox, % "5 Examples:`n" Out "`nTotal Pairs:`n`t" M.MaxIndex() + +Reverse(s) { + Loop, Parse, s + r := A_LoopField . r + return r +} diff --git a/Task/Send-an-unknown-method-call/Objective-C/send-an-unknown-method-call.m b/Task/Send-an-unknown-method-call/Objective-C/send-an-unknown-method-call.m index 60b585f8ec..f9e9c6238b 100644 --- a/Task/Send-an-unknown-method-call/Objective-C/send-an-unknown-method-call.m +++ b/Task/Send-an-unknown-method-call/Objective-C/send-an-unknown-method-call.m @@ -1,23 +1,22 @@ #import-@interface Example : NSObject { } +@interface Example : NSObject - (NSNumber *)foo; @end @implementation Example - (NSNumber *)foo { - return [NSNumber numberWithInt:42]; + return @42; } @end int main (int argc, const char *argv[]) { - NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; + @autoreleasepool { - id example = [[Example alloc] init]; - SEL selector = @selector(foo); // or = NSSelectorFromString(@"foo"); - NSLog(@"%@", [example performSelector:selector]); - [example release]; + id example = [[Example alloc] init]; + SEL selector = @selector(foo); // or = NSSelectorFromString(@"foo"); + NSLog(@"%@", [example performSelector:selector]); - [pool release]; + } return 0; } diff --git a/Task/Sequence-of-non-squares/D/sequence-of-non-squares.d b/Task/Sequence-of-non-squares/D/sequence-of-non-squares.d index 7d180200bd..47710f48a0 100644 --- a/Task/Sequence-of-non-squares/D/sequence-of-non-squares.d +++ b/Task/Sequence-of-non-squares/D/sequence-of-non-squares.d @@ -1,14 +1,14 @@ import std.stdio, std.math, std.algorithm, std.range; int nonSquare(in int n) pure nothrow { - return n + cast(int)(0.5 + sqrt(cast(real)n)); + return n + cast(int)(0.5 + real(n).sqrt); } void main() { - iota(1, 23).map!nonSquare().writeln(); + iota(1, 23).map!nonSquare.writeln; - foreach (i; 1 .. 1_000_000) { - int ns = nonSquare(i); - assert(ns != (cast(int)sqrt(cast(real)ns)) ^^ 2); + foreach (immutable i; 1 .. 1_000_000) { + immutable ns = i.nonSquare; + assert(ns != (cast(int)real(ns).sqrt) ^^ 2); } } diff --git a/Task/Set-consolidation/Common-Lisp/set-consolidation.lisp b/Task/Set-consolidation/Common-Lisp/set-consolidation.lisp new file mode 100644 index 0000000000..641cf33452 --- /dev/null +++ b/Task/Set-consolidation/Common-Lisp/set-consolidation.lisp @@ -0,0 +1,8 @@ +(defun consolidate (ss) + (labels ((comb (cs s) + (cond ((null s) cs) + ((null cs) (list s)) + ((null (intersection s (first cs))) + (cons (first cs) (comb (rest cs) s))) + ((consolidate (cons (union s (first cs)) (rest cs))))))) + (reduce #'comb ss :initial-value nil))) diff --git a/Task/Set-consolidation/TXR/set-consolidation-1.txr b/Task/Set-consolidation/TXR/set-consolidation-1.txr new file mode 100644 index 0000000000..6208b8643a --- /dev/null +++ b/Task/Set-consolidation/TXR/set-consolidation-1.txr @@ -0,0 +1,26 @@ +@(do + (defun mkset (p x) (set [p x] (or [p x] x))) + + (defun fnd (p x) (if (eq [p x] x) x (fnd p [p x]))) + + (defun uni (p x y) + (let ((xr (fnd p x)) (yr (fnd p y))) + (set [p xr] yr))) + + (defun consoli (sets) + (let ((p (hash))) + (each ((s sets)) + (each ((e s)) + (mkset p e) + (uni p e (car s)))) + (hash-values + [group-by (op fnd p) (hash-keys + [group-by identity (flatten sets)])]))) + + ;; tests + + (each ((test '(((a b) (c d)) + ((a b) (b d)) + ((a b) (c d) (d b)) + ((h i k) (a b) (c d) (d b) (f g h))))) + (format t "~s -> ~s\n" test (consoli test)))) diff --git a/Task/Set-consolidation/TXR/set-consolidation-2.txr b/Task/Set-consolidation/TXR/set-consolidation-2.txr new file mode 100644 index 0000000000..2ee935f256 --- /dev/null +++ b/Task/Set-consolidation/TXR/set-consolidation-2.txr @@ -0,0 +1,21 @@ +@(do + (defun mkset (items) [group-by identity items]) + + (defun empty-p (set) (zerop (hash-count set))) + + (defun consoli (ss) + (defun comb (cs s) + (cond ((empty-p s) cs) + ((null cs) (list s)) + ((empty-p (hash-isec s (first cs))) + (cons (first cs) (comb (rest cs) s))) + (t (consoli (cons (hash-uni s (first cs)) (rest cs)))))) + [reduce-left comb ss nil]) + + ;; tests + (each ((test '(((a b) (c d)) + ((a b) (b d)) + ((a b) (c d) (d b)) + ((h i k) (a b) (c d) (d b) (f g h))))) + (format t "~s -> ~s\n" test + [mapcar hash-keys (consoli [mapcar mkset test])]))) diff --git a/Task/Set-puzzle/AutoHotkey/set-puzzle.ahk b/Task/Set-puzzle/AutoHotkey/set-puzzle.ahk new file mode 100644 index 0000000000..6b3a18f006 --- /dev/null +++ b/Task/Set-puzzle/AutoHotkey/set-puzzle.ahk @@ -0,0 +1,104 @@ +; Generate deck; card encoding from Perl6 +Loop, 81 + deck .= ToBase(A_Index-1, 3)+1111 "," +deck := RegExReplace(deck, "3", "4") + +; Shuffle +deck := shuffle(deck) + +msgbox % clipboard := allValidSets(9, 4, deck) +msgbox % clipboard := allValidSets(12, 6, deck) + +; Render a hand (or any list) of cards +PrettyHand(hand) { + Color1:="red",Color2:="green",Color4:="purple" + ,Symbl1:="oval",Symbl2:="squiggle",Symbl4:="diamond" + ,Numbr1:="one",Numbr2:="two",Numbr4:="three" + ,Shape1:="solid",Shape2:="open",Shape4:="striped" + Loop, Parse, hand, `, + { + StringSplit, i, A_LoopField + s .= "`t" Color%i1% "`t" Symbl%i2% "`t" Numbr%i3% "`t" Shape%i4% "`n" + } + Return s +} + +; Get all unique valid sets of three cards in a hand. +allValidSets(n, m, deck) { + While j != m + { + j := 0 + ,hand := draw(n, deck) + ,s := "Dealt " n " cards:`n" . prettyhand(hand) + StringSplit, set, hand, `, + comb := comb(n,3) + Loop, Parse, comb, `n + { + StringSplit, i, A_LoopField, %A_Space% + If isValidSet(set%i1%, set%i2%, set%i3%) + s .= "`nSet " ++j ":`n" . prettyhand(set%i1% "," set%i2% "," set%i3%) + } + } + Return s +} + +; Convert n to arbitrary base using recursion +toBase(n,b) { ; n >= 0, 1 < b < StrLen(t), t = digits + Static t := "0123456789ABCDEF" + Return (n < b ? "" : ToBase(n//b,b)) . SubStr(t,mod(n,b)+1,1) +} + +; Knuth shuffle from http://rosettacode.org/wiki/Knuth_Shuffle#AutoHotkey +shuffle(list) { ; shuffle comma separated list, converted to array + StringSplit a, list, `, ; make array (length = a0) + Loop % a0-1 { + Random i, A_Index, a0 ; swap item 1,2... with a random item to the right of it + t := a%i%, a%i% := a%A_Index%, a%A_Index% := t + } + Loop % a0 ; construct string from sorted array + s .= "," . a%A_Index% + Return SubStr(s,2) ; drop leading comma +} + +; Randomly pick a hand of cards from the deck +draw(n, deck) { + Loop, % n + { + Random, i, 1, 81 + cards := deck + Loop, Parse, cards, `, + (A_Index = i) ? (hand .= A_LoopField ",") : (cards .= A_LoopField ",") + deck := cards + } + Return SubStr(hand, 1, -1) +} + +; Test if a particular group of three cards is a valid set +isValidSet(a, b, c) { + StringSplit, a, a + StringSplit, b, b + StringSplit, c, c + Return !((a1|b1|c1 ~= "[3,5,6]") + (a2|b2|c2 ~= "[3,5,6]") + (a3|b3|c3 ~= "[3,5,6]") + (a4|b4|c4 ~= "[3,5,6]")) +} + +; Get all combinations, from http://rosettacode.org/wiki/Combinations#AutoHotkey +comb(n,t) { ; Generate all n choose t combinations of 1..n, lexicographically + IfLess n,%t%, Return + Loop %t% + c%A_Index% := A_Index + i := t+1, c%i% := n+1 + + Loop { + Loop %t% + i := t+1-A_Index, c .= c%i% " " + c .= "`n" ; combinations in new lines + j := 1, i := 2 + Loop + If (c%j%+1 = c%i%) + c%j% := j, ++j, ++i + Else Break + If (j > t) + Return c + c%j% += 1 + } +} diff --git a/Task/Set-puzzle/Perl-6/set-puzzle.pl6 b/Task/Set-puzzle/Perl-6/set-puzzle.pl6 index 85bf2ea774..9681dfaeaa 100644 --- a/Task/Set-puzzle/Perl-6/set-puzzle.pl6 +++ b/Task/Set-puzzle/Perl-6/set-puzzle.pl6 @@ -6,7 +6,10 @@ enum Style (solid => 0o1, open => 0o2, striped => 0o4); my @deck := (Color.enums X Count.enums X Shape.enums X Style.enums).tree; sub MAIN($DRAW = 9, $GOAL = $DRAW div 2) { - my @combinations = combine(3, [^$DRAW]); + sub show-cards(@c) { printf " %-6s %-5s %-8s %s\n", $_».key for @c } + + my @combinations = [^$DRAW].combinations(3); + my @draw; repeat until (my @sets) == $GOAL { @draw = @deck.pick($DRAW); @@ -15,6 +18,7 @@ sub MAIN($DRAW = 9, $GOAL = $DRAW div 2) { take @draw[@c].item when /^ <[1247]>+ $/ given ( [+|] @bits[@c] ).base(8); } } + say "Drew $DRAW cards:"; show-cards @draw; for @sets.kv -> $i, @cards { @@ -22,5 +26,3 @@ sub MAIN($DRAW = 9, $GOAL = $DRAW div 2) { show-cards @cards; } } - -sub show-cards(@c) { for @c -> $c { printf " %-6s %-5s %-8s %s\n", $c».key } } diff --git a/Task/Set/AutoHotkey/set-1.ahk b/Task/Set/AutoHotkey/set-1.ahk new file mode 100644 index 0000000000..e98d41e300 --- /dev/null +++ b/Task/Set/AutoHotkey/set-1.ahk @@ -0,0 +1,51 @@ +test(Set,element){ + for i, val in Set + if (val=element) + return true + return false +} + +Union(SetA,SetB){ + SetC:=[], Temp:=[] + for i, val in SetA + SetC.Insert(val), Temp[val] := true + for i, val in SetB + if !Temp[val] + SetC.Insert(val) + return SetC +} + +intersection(SetA,SetB){ + SetC:=[], Temp:=[] + for i, val in SetA + Temp[val] := true + for i, val in SetB + if Temp[val] + SetC.Insert(val) + return SetC +} + +difference(SetA,SetB){ + SetC:=[], Temp:=[] + for i, val in SetB + Temp[val] := true + for i, val in SetA + if !Temp[val] + SetC.Insert(val) + return SetC +} + +subset(SetA,SetB){ + Temp:=[], A:=B:=0 + for i, val in SetA + Temp[val] := true , A++ + for i, val in SetB + if Temp[val]{ + B++ + IfEqual, A, %B%, return 1 + } return 0 +} + +equal(SetA,SetB){ + return (SetA.MaxIndex() = SetB.MaxIndex() && subset(SetA,SetB)) ? 1: 0 +} diff --git a/Task/Set/AutoHotkey/set-2.ahk b/Task/Set/AutoHotkey/set-2.ahk new file mode 100644 index 0000000000..253e290849 --- /dev/null +++ b/Task/Set/AutoHotkey/set-2.ahk @@ -0,0 +1,42 @@ +A:= ["apple", "cherry", "elderberry", "grape"] +B:= ["banana", "cherry", "date", "elderberry", "fig"] +C:= ["apple", "cherry", "elderberry", "grape", "orange"] +D:= ["apple", "cherry", "elderberry", "grape"] +E:= ["apple", "cherry", "elderberry"] +M:= "banana" + +Res = +( +A:= ["apple", "cherry", "elderberry", "grape"] +B:= ["banana", "cherry", "date", "elderberry", "fig"] +C:= ["apple", "cherry", "elderberry", "grape", "orange"] +D:= ["apple", "cherry", "elderberry", "grape"] +E:= ["apple", "cherry", "elderberry"] +M:= "banana" + +) + +Res .= "`nM is " (test(A,M)?"":"not ") "an element of Set A" +Res .= "`nM is " (test(B,M)?"":"not ") "an element of Set B" + +Res .= "`nUnion(A,B) = " +for i, val in Union(A,B) + Res.= (A_Index=1?"`t":", ") val + +Res .= "`nintersection(A,B) = " +for i, val in intersection(A,B) + Res.= (A_Index=1?"`t":", ") val + +Res .= "`ndifference(A,B) = " +for i, val in difference(A,B) + Res.= (A_Index=1?"`t":", ") val + +Res .= "`n`nA is " (subset(A,C)?"":"not ") "a subset of Set C" +Res .= "`nA is " (subset(A,D)?"":"not ") "a subset of Set D" +Res .= "`nA is " (subset(A,E)?"":"not ") "a subset of Set E" + +Res .= "`n`nA is " (equal(A,C)?"":"not ") "a equal to Set C" +Res .= "`nA is " (equal(A,D)?"":"not ") "a equal to Set D" +Res .= "`nA is " (equal(A,E)?"":"not ") "a equal to Set E" + +MsgBox % Res diff --git a/Task/Set/Dart/set.dart b/Task/Set/Dart/set.dart new file mode 100644 index 0000000000..1d2c26a0eb --- /dev/null +++ b/Task/Set/Dart/set.dart @@ -0,0 +1,38 @@ +void main(){ + //Set Creation + Set A = new Set.from([1,2,3]); + Set B = new Set.from([1,2,3,4,5]); + Set C = new Set.from([1,2,4,5]); + + print('Set A = $A'); + print('Set B = $B'); + print('Set C = $C'); + print(''); + //Test if element is in set + int m = 3; + print('m = 5'); + print('m in A = ${A.contains(m)}'); + print('m in B = ${B.contains(m)}'); + print('m in C = ${C.contains(m)}'); + print(''); + //Union of two sets + Set AC = A.union(C); + print('Set AC = Union of A and C = $AC'); + print(''); + //Intersection of two sets + Set A_C = A.intersection(C); + print('Set A_C = Intersection of A and C = $A_C'); + print(''); + //Difference of two sets + Set A_diff_C = A.difference(C); + print('Set A_diff_C = Difference between A and C = $A_diff_C'); + print(''); + //Test if set is subset of another set + print('A is a subset of B = ${B.containsAll(A)}'); + print('C is a subset of B = ${B.containsAll(C)}'); + print('A is a subset of C = ${C.containsAll(A)}'); + print(''); + //Test if two sets are equal + print('A is equal to B = ${B.containsAll(A) && A.containsAll(B)}'); + print('B is equal to AC = ${B.containsAll(AC) && AC.containsAll(B)}'); +} diff --git a/Task/Set/Objective-C/set.m b/Task/Set/Objective-C/set.m index 23782b0168..664ab8e65d 100644 --- a/Task/Set/Objective-C/set.m +++ b/Task/Set/Objective-C/set.m @@ -1,57 +1,57 @@ #import int main (int argc, const char *argv[]) { - NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; + @autoreleasepool { - NSSet *s1 = [NSSet setWithObjects:@"a", @"b", @"c", @"d", @"e", nil]; - NSSet *s2 = [NSSet setWithObjects:@"b", @"c", @"d", @"e", @"f", @"h", nil]; - NSSet *s3 = [NSSet setWithObjects:@"b", @"c", @"d", nil]; - NSSet *s4 = [NSSet setWithObjects:@"b", @"c", @"d", nil]; - NSLog(@"s1: %@", s1); - NSLog(@"s2: %@", s2); - NSLog(@"s3: %@", s3); - NSLog(@"s4: %@", s4); + NSSet *s1 = [NSSet setWithObjects:@"a", @"b", @"c", @"d", @"e", nil]; + NSSet *s2 = [NSSet setWithObjects:@"b", @"c", @"d", @"e", @"f", @"h", nil]; + NSSet *s3 = [NSSet setWithObjects:@"b", @"c", @"d", nil]; + NSSet *s4 = [NSSet setWithObjects:@"b", @"c", @"d", nil]; + NSLog(@"s1: %@", s1); + NSLog(@"s2: %@", s2); + NSLog(@"s3: %@", s3); + NSLog(@"s4: %@", s4); - // Membership - NSLog(@"b in s1: %d", [s1 containsObject:@"b"]); - NSLog(@"f in s1: %d", [s1 containsObject:@"f"]); + // Membership + NSLog(@"b in s1: %d", [s1 containsObject:@"b"]); + NSLog(@"f in s1: %d", [s1 containsObject:@"f"]); - // Union - NSMutableSet *s12 = [NSMutableSet setWithSet:s1]; - [s12 unionSet:s2]; - NSLog(@"s1 union s2: %@", s12); + // Union + NSMutableSet *s12 = [NSMutableSet setWithSet:s1]; + [s12 unionSet:s2]; + NSLog(@"s1 union s2: %@", s12); - // Intersection - NSMutableSet *s1i2 = [NSMutableSet setWithSet:s1]; - [s1i2 intersectSet:s2]; - NSLog(@"s1 intersect s2: %@", s1i2); + // Intersection + NSMutableSet *s1i2 = [NSMutableSet setWithSet:s1]; + [s1i2 intersectSet:s2]; + NSLog(@"s1 intersect s2: %@", s1i2); - // Difference - NSMutableSet *s1_2 = [NSMutableSet setWithSet:s1]; - [s1_2 minusSet:s2]; - NSLog(@"s1 - s2: %@", s1_2); + // Difference + NSMutableSet *s1_2 = [NSMutableSet setWithSet:s1]; + [s1_2 minusSet:s2]; + NSLog(@"s1 - s2: %@", s1_2); - // Subset of - NSLog(@"s3 subset of s1: %d", [s3 isSubsetOfSet:s1]); + // Subset of + NSLog(@"s3 subset of s1: %d", [s3 isSubsetOfSet:s1]); - // Equality - NSLog(@"s3 = s4: %d", [s3 isEqualToSet:s4]); + // Equality + NSLog(@"s3 = s4: %d", [s3 isEqualToSet:s4]); - // Cardinality - NSLog(@"size of s1: %lu", [s1 count]); + // Cardinality + NSLog(@"size of s1: %lu", [s1 count]); - // Has intersection (not disjoint) - NSLog(@"does s1 intersect s2? %d", [s1 intersectsSet:s2]); + // Has intersection (not disjoint) + NSLog(@"does s1 intersect s2? %d", [s1 intersectsSet:s2]); - // Adding and removing elements from a mutable set - NSMutableSet *mut_s1 = [NSMutableSet setWithSet:s1]; - [mut_s1 addObject:@"g"]; - NSLog(@"mut_s1 after adding g: %@", mut_s1); - [mut_s1 addObject:@"b"]; - NSLog(@"mut_s1 after adding b again: %@", mut_s1); - [mut_s1 removeObject:@"c"]; - NSLog(@"mut_s1 after removing c: %@", mut_s1); + // Adding and removing elements from a mutable set + NSMutableSet *mut_s1 = [NSMutableSet setWithSet:s1]; + [mut_s1 addObject:@"g"]; + NSLog(@"mut_s1 after adding g: %@", mut_s1); + [mut_s1 addObject:@"b"]; + NSLog(@"mut_s1 after adding b again: %@", mut_s1); + [mut_s1 removeObject:@"c"]; + NSLog(@"mut_s1 after removing c: %@", mut_s1); - [pool release]; + } return 0; } diff --git a/Task/Shell-one-liner/Prolog/shell-one-liner-1.pro b/Task/Shell-one-liner/Prolog/shell-one-liner-1.pro new file mode 100644 index 0000000000..5dd20ae4a6 --- /dev/null +++ b/Task/Shell-one-liner/Prolog/shell-one-liner-1.pro @@ -0,0 +1,3 @@ +$ swipl -g "writeln('hello world')." -t 'halt.' +hello world +$ diff --git a/Task/Shell-one-liner/Prolog/shell-one-liner-2.pro b/Task/Shell-one-liner/Prolog/shell-one-liner-2.pro new file mode 100644 index 0000000000..0ca7d5e7d5 --- /dev/null +++ b/Task/Shell-one-liner/Prolog/shell-one-liner-2.pro @@ -0,0 +1,3 @@ +$ gprolog --init-goal "write('goodbye'),nl,halt" +goodbye +$ diff --git a/Task/Shell-one-liner/Prolog/shell-one-liner-3.pro b/Task/Shell-one-liner/Prolog/shell-one-liner-3.pro new file mode 100644 index 0000000000..6c733aedf2 --- /dev/null +++ b/Task/Shell-one-liner/Prolog/shell-one-liner-3.pro @@ -0,0 +1,2 @@ +$ yap -q -g "current_prolog_flag(dialect, D), writeln(D), halt" +yap diff --git a/Task/Shell-one-liner/Prolog/shell-one-liner-4.pro b/Task/Shell-one-liner/Prolog/shell-one-liner-4.pro new file mode 100644 index 0000000000..7b715c4e4b --- /dev/null +++ b/Task/Shell-one-liner/Prolog/shell-one-liner-4.pro @@ -0,0 +1,5 @@ +$ swipl -q <<< "current_prolog_flag(dialect,D), writeln(D), halt." +swi + +$ yap -q <<< "current_prolog_flag(dialect,D), writeln(D), halt." +yap diff --git a/Task/Shell-one-liner/Prolog/shell-one-liner-5.pro b/Task/Shell-one-liner/Prolog/shell-one-liner-5.pro new file mode 100644 index 0000000000..1175ad418d --- /dev/null +++ b/Task/Shell-one-liner/Prolog/shell-one-liner-5.pro @@ -0,0 +1,5 @@ +$ echo "current_prolog_flag(dialect,D), writeln(D), halt." | swipl -q +swi + +$ echo "current_prolog_flag(dialect,D), writeln(D), halt." | yap -q +yap diff --git a/Task/Shell-one-liner/TXR/shell-one-liner.txr b/Task/Shell-one-liner/TXR/shell-one-liner-1.txr similarity index 100% rename from Task/Shell-one-liner/TXR/shell-one-liner.txr rename to Task/Shell-one-liner/TXR/shell-one-liner-1.txr diff --git a/Task/Shell-one-liner/TXR/shell-one-liner-2.txr b/Task/Shell-one-liner/TXR/shell-one-liner-2.txr new file mode 100644 index 0000000000..ccbd00f0de --- /dev/null +++ b/Task/Shell-one-liner/TXR/shell-one-liner-2.txr @@ -0,0 +1,2 @@ +$ txr -p '(+ 2 2)' +4 diff --git a/Task/Shell-one-liner/TXR/shell-one-liner-3.txr b/Task/Shell-one-liner/TXR/shell-one-liner-3.txr new file mode 100644 index 0000000000..ee3bf8a4ac --- /dev/null +++ b/Task/Shell-one-liner/TXR/shell-one-liner-3.txr @@ -0,0 +1,3 @@ +$ txr -e '(mkdir "foo" #o777)' +$ ls -ld foo +drwxrwxr-x 2 kaz kaz 4096 Mar 4 23:36 foo diff --git a/Task/Short-circuit-evaluation/Forth/short-circuit-evaluation.fth b/Task/Short-circuit-evaluation/Forth/short-circuit-evaluation.fth index 454406fbec..c3eb188900 100644 --- a/Task/Short-circuit-evaluation/Forth/short-circuit-evaluation.fth +++ b/Task/Short-circuit-evaluation/Forth/short-circuit-evaluation.fth @@ -1,20 +1,28 @@ -\ short-circuit conditional syntax, from Wil Baden -: COND 0 ; immediate -: THENS BEGIN dup WHILE postpone THEN REPEAT DROP ; immediate -: ORIF s" ?DUP 0= IF" evaluate ; immediate -: ANDIF s" DUP IF DROP" evaluate ; immediate +\ Short-circuit evaluation definitions from Wil Baden, with minor name changes +: ENDIF postpone THEN ; immediate -: .bool IF ." true " ELSE ." false" THEN ; -: A ." A=" dup .bool ; -: B ." B=" dup .bool ; +: COND 0 ; immediate +: ENDIFS BEGIN DUP WHILE postpone ENDIF REPEAT DROP ; immediate +: ORELSE s" ?DUP 0= IF" evaluate ; immediate +: ANDIF s" DUP IF DROP" evaluate ; immediate + +: .bool IF ." true " ELSE ." false " THEN ; +: A ." A=" DUP .bool ; +: B ." B=" DUP .bool ; : test + CR 1 -1 DO 1 -1 DO - CR I A drop space J B drop space - ." : ANDIF " COND I A ANDIF drop J B IF ." (BOTH)" THENS - ." , ORIF " COND I A ORIF drop J B 0= IF ." (NEITHER)" THENS + COND I A ANDIF J B ENDIFS ." ANDIF=" .bool CR + COND I A ORELSE J B ENDIFS ." ORELSE=" .bool CR LOOP LOOP ; -\ a more typical example -: alnum? ( char -- ? ) - COND dup lower? ORIF dup upper? ORIF dup digit? THENS nip ; +\ An alternative based on explicitly short-circuiting conditionals, Dave Keenan +: END-PRIOR-IF 1 CS-ROLL postpone ENDIF ; immediate + +: test + CR + 1 -1 DO 1 -1 DO + I A IF J B IF 1 ELSE END-PRIOR-IF 0 ENDIF ." ANDIF=" .bool CR + I A 0= IF J B IF END-PRIOR-IF 1 ELSE 0 ENDIF ." ORELSE=" .bool CR + LOOP LOOP ; diff --git a/Task/Show-the-epoch/Objective-C/show-the-epoch.m b/Task/Show-the-epoch/Objective-C/show-the-epoch.m index d27fca0a74..6bfa2d63a6 100644 --- a/Task/Show-the-epoch/Objective-C/show-the-epoch.m +++ b/Task/Show-the-epoch/Objective-C/show-the-epoch.m @@ -1,14 +1,14 @@ #import int main(int argc, const char *argv[]) { - NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; + @autoreleasepool { - NSDate *t = [NSDate dateWithTimeIntervalSinceReferenceDate:0]; - NSDateFormatter *dateFormatter = [[[NSDateFormatter alloc] init] autorelease]; - [dateFormatter setTimeZone:[NSTimeZone timeZoneWithName:@"UTC"]]; - [dateFormatter setDateFormat:@"yyyy-MM-dd HH:mm:ss ZZ"]; - NSLog(@"%@", [dateFormatter stringFromDate:t]); + NSDate *t = [NSDate dateWithTimeIntervalSinceReferenceDate:0]; + NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; + [dateFormatter setTimeZone:[NSTimeZone timeZoneWithName:@"UTC"]]; + [dateFormatter setDateFormat:@"yyyy-MM-dd HH:mm:ss ZZ"]; + NSLog(@"%@", [dateFormatter stringFromDate:t]); - [pool release]; + } return 0; } diff --git a/Task/Show-the-epoch/PARI-GP/show-the-epoch.pari b/Task/Show-the-epoch/PARI-GP/show-the-epoch.pari new file mode 100644 index 0000000000..ef15bad44b --- /dev/null +++ b/Task/Show-the-epoch/PARI-GP/show-the-epoch.pari @@ -0,0 +1 @@ +system("date -ur 0") diff --git a/Task/Sierpinski-carpet/D/sierpinski-carpet-2.d b/Task/Sierpinski-carpet/D/sierpinski-carpet-2.d index b3d51536c0..7be12d93dc 100644 --- a/Task/Sierpinski-carpet/D/sierpinski-carpet-2.d +++ b/Task/Sierpinski-carpet/D/sierpinski-carpet-2.d @@ -2,7 +2,7 @@ import std.stdio, std.algorithm, std.range, std.functional; auto nextCarpet(in string[] c) pure nothrow { /*immutable*/ const b = c.map!q{a ~ a ~ a}.array; - return b ~ c.map!q{a ~ a.replace("#", ' ') ~ a}.array ~ b; + return b ~ c.map!q{a ~ a.replace("#", " ") ~ a}.array ~ b; } void main() { diff --git a/Task/Sierpinski-carpet/REXX/sierpinski-carpet.rexx b/Task/Sierpinski-carpet/REXX/sierpinski-carpet.rexx index a2862f5dc2..f0437c6882 100644 --- a/Task/Sierpinski-carpet/REXX/sierpinski-carpet.rexx +++ b/Task/Sierpinski-carpet/REXX/sierpinski-carpet.rexx @@ -5,27 +5,19 @@ if n=='' | n==',' then n=3 /*if none specified, assume 3. */ if char=='' then char='*' /*use the default of an asterisk.*/ if length(char)==2 then char=x2c(char) /*it was specified in hexadecimal*/ if length(char)==3 then char=d2c(char) /*it was specified in decimal. */ - /*LINESIZE isn't in some REXXes. */ -/* width=linesize() */ /*maximum width of the screen. */ - width=132 - - do j=0 for 3**n; z= /* z is the line to be displayed.*/ - - do k=0 for 3**n; jj=j; kk=k; xChar=char - - do while jj\==0 & kk\==0 /*one symbol for not is \ */ - if jj//3==1 & kk//3==1 then do /* // = remainder.*/ - xChar=' ' /*use a blank. */ - leave /*leaves DO while.*/ - end +width=132 /*width of a terminal screen. */ + do j=0 for 3**n; z= /* z is the line to be displayed.*/ + do k=0 for 3**n; jj=j; kk=k; xChar=char + do while jj\==0 & kk\==0 /*one symbol for a not (¬) is \ */ + if jj//3==1 & kk//3==1 then do /* // = remainder.*/ + xChar=' ' /*use a blank. */ + leave /*leaves DO while.*/ + end jj=jj%3 kk=kk%3 /*% means it's integer division.*/ end /*while*/ - - z=z || xChar /*it's either black or white. */ - end /*k*/ - - if length(z) = Width) ? (x := i*Width/2/k, y += Height/k, i:=!i) : "" + } + UpdateLayeredWindow(hwnd1, hdc, (A_ScreenWidth-Width)/2, (A_ScreenHeight-Height)/2, Width, Height) + , k*=2, x:=0, y:=0, i:=1 +} + +Gdip_DeleteBrush(pBrushBlack) + +, UpdateLayeredWindow(hwnd1, hdc, (A_ScreenWidth-Width)/2, (A_ScreenHeight-Height)/2, Width, Height) +Sleep, 1*1000 + +; Bonus: Sierpinski triangle by random dots +Gdip_GraphicsClear(G, 0xff000000) +, pBrushBlue := Gdip_BrushCreateSolid(0xff0000ff) +, x1:=Width/2, y1:=0, x2:=0, y2:=Height, x3:=Width, y3:=Height +, x:= Width/2, y:=Height/2 ; I'm to lazy to pick a random point. +Loop, % n +{ + Loop, % 10*10**(A_Index/2) + { + Random, rand, 1, 3 + x := abs(x+x%rand%)/2 + , y := abs(y+y%rand%)/2 + , Gdip_FillEllipse(G, pBrushBlue, x, y, 1, 1) + } + UpdateLayeredWindow(hwnd1, hdc, (A_ScreenWidth-Width)/2, (A_ScreenHeight-Height)/2, Width, Height) + Sleep, 0.5*1000 +} +SelectObject(hdc, obm) +, DeleteObject(hbm) +, DeleteDC(hdc) +, Gdip_DeleteGraphics(G) +Return + +Exit: + Gdip_Shutdown(pToken) + ExitApp + +WM_LBUTTONDOWN() +{ + If (A_Gui = 1) + PostMessage, 0xA1, 2 +} diff --git a/Task/Sierpinski-triangle/PARI-GP/sierpinski-triangle.pari b/Task/Sierpinski-triangle/PARI-GP/sierpinski-triangle.pari new file mode 100644 index 0000000000..ccfed27522 --- /dev/null +++ b/Task/Sierpinski-triangle/PARI-GP/sierpinski-triangle.pari @@ -0,0 +1,11 @@ +Sierpinski(n)={ + my(s=2^n-1); + forstep(y=s,0,-1, + for(i=1,y,print1(" ")); + for(x=0,s-y, + print1(if(bitand(x,y)," ","*")) + ); + print() + ) +}; +Sierpinski(4) diff --git a/Task/Sierpinski-triangle/Perl-6/sierpinski-triangle.pl6 b/Task/Sierpinski-triangle/Perl-6/sierpinski-triangle.pl6 index 5fd4048634..69ad29facf 100644 --- a/Task/Sierpinski-triangle/Perl-6/sierpinski-triangle.pl6 +++ b/Task/Sierpinski-triangle/Perl-6/sierpinski-triangle.pl6 @@ -3,7 +3,7 @@ sub sierpinski ($n) { my $space = ' '; for ^$n { @down = @down.map({"$space$_$space"}), @down.map({"$_ $_"}); - $space ~= $space; + $space x= 2; } return @down; } diff --git a/Task/Sierpinski-triangle/REXX/sierpinski-triangle.rexx b/Task/Sierpinski-triangle/REXX/sierpinski-triangle.rexx index a91980184e..d4bb05f2bf 100644 --- a/Task/Sierpinski-triangle/REXX/sierpinski-triangle.rexx +++ b/Task/Sierpinski-triangle/REXX/sierpinski-triangle.rexx @@ -5,13 +5,13 @@ if mk=='' then mk='*' /*use the default of an asterisk.*/ if length(mk)==2 then mk=x2c(mk) /*MK was specified in hexadecimal*/ if length(mk)==3 then mk=d2c(mk) /*MK was specified in decimal. */ numeric digits 12000 /*this otta handle the die-hards.*/ - + /* [↓] the blood-'n-guts of pgm.*/ do j=0 for n*4; !=1; z=left('',n*4-1-j) /*indent the line. */ - do k=0 to j /*build the line with J+1 parts*/ - if !//2==0 then z=z' ' /*it's either a blank, or ... */ + do k=0 for j+1 /*build the line with J+1 parts*/ + if !//2==0 then z=z' ' /*it's either a blank, or ··· */ else z=z mk /*it's one of them thar character*/ !=!*(j-k)%(k+1) /*calculate a handy-dandy thingy.*/ - end /*k*/ + end /*k*/ /* [↑] finished building a line.*/ say z /*display a line of the triangle.*/ - end /*j*/ + end /*j*/ /* [↑] finished displaying tri. */ /*stick a fork in it, we're done.*/ diff --git a/Task/Sieve-of-Eratosthenes/D/sieve-of-eratosthenes-2.d b/Task/Sieve-of-Eratosthenes/D/sieve-of-eratosthenes-2.d index 412b08937d..2d0bf669cb 100644 --- a/Task/Sieve-of-Eratosthenes/D/sieve-of-eratosthenes-2.d +++ b/Task/Sieve-of-Eratosthenes/D/sieve-of-eratosthenes-2.d @@ -21,7 +21,7 @@ size_t[] sieve(in size_t m) pure nothrow { F[offset] = F[offset] ^ mask; } - for (size_t i = 3; i <= sqrt(cast(real)n); i += 2) + for (size_t i = 3; i <= sqrt(real(n)); i += 2) if (isSet((i - 3) / 2)) for (size_t j = i * i; j <= n; j += 2 * i) resetBit((j - 3) / 2); diff --git a/Task/Sieve-of-Eratosthenes/D/sieve-of-eratosthenes-3.d b/Task/Sieve-of-Eratosthenes/D/sieve-of-eratosthenes-3.d index eaacabf791..4d5d9716ea 100644 --- a/Task/Sieve-of-Eratosthenes/D/sieve-of-eratosthenes-3.d +++ b/Task/Sieve-of-Eratosthenes/D/sieve-of-eratosthenes-3.d @@ -1,39 +1,35 @@ -import std.algorithm, std.bitmanip; - /// Extensible Sieve of Eratosthenes. -struct IsPrime { - //__gshared static BitArray multiples = [true, true, false]; - __gshared static BitArray multiples; +struct Prime { + uint[] a = [2]; - /*nothrow*/ static this() { - multiples.init([true, true, false]); - } + private void grow() pure nothrow { + immutable p0 = a[$ - 1] + 1; + auto b = new bool[p0]; - static bool opCall(in size_t n) /*nothrow*/ { - if (n >= multiples.length) { - // Extend the sieve. - immutable oldLen = multiples.length; // Not nothrow. - immutable newMax = max((oldLen - 1) * 2, n); - multiples.length = newMax + 1; - foreach (immutable p; 2 .. oldLen) - if (!multiples[p]) - for (size_t i = p * ((oldLen + p) / p); - i < newMax + 1; i += p) - multiples[i] = true; - foreach (immutable i; oldLen .. newMax + 1) - if (!multiples[i]) - for (size_t j = i * 2; j < newMax + 1; j += i) - multiples[j] = true; + foreach (immutable di; a) { + immutable uint i0 = p0 / di * di; + uint i = (i0 < p0) ? i0 + di - p0 : i0 - p0; + for (; i < b.length; i += di) + b[i] = true; } - return !multiples[n]; + foreach (immutable uint i, immutable bi; b) + if (!b[i]) + a ~= p0 + i; + } + + uint opCall(in uint n) pure nothrow { + while (n >= a.length) + grow; + return a[n]; } } version (sieve_of_eratosthenes3_main) { - import std.stdio, std.range; - void main() { - 50.iota.filter!IsPrime.writeln; + import std.stdio, std.range, std.algorithm; + + Prime prime; + uint.max.iota.map!prime.until!q{a > 50}.writeln; } } diff --git a/Task/Sieve-of-Eratosthenes/Haskell/sieve-of-eratosthenes-3.hs b/Task/Sieve-of-Eratosthenes/Haskell/sieve-of-eratosthenes-3.hs index 51c7d0cd11..62777bf026 100644 --- a/Task/Sieve-of-Eratosthenes/Haskell/sieve-of-eratosthenes-3.hs +++ b/Task/Sieve-of-Eratosthenes/Haskell/sieve-of-eratosthenes-3.hs @@ -1,9 +1,13 @@ -primesTo m = 2 : eratos [3,5..m] where - eratos (p : xs) | p*p>m = p : xs - | True = p : eratos (xs `minus` [p*p, p*p+2*p..m]) +import Data.Array.Unboxed -minus a@(x:xs) b@(y:ys) = case compare x y of - LT -> x : minus xs b - EQ -> minus xs ys - GT -> minus a ys -minus a b = a +primesSA = 2 : prs () + where + prs () = 3 : sieve 3 [] (prs ()) + sieve x fs (p:ps) = [i*2 + x | (i,True) <- assocs a] + ++ sieve (p*p) fs2 ps + where + q = (p*p-x)`div`2 + fs2 = (p,0) : [(s, rem (y-q) s) | (s,y) <- fs] + a :: UArray Int Bool + a = accumArray (\ b c -> False) True (1,q-1) + [(i,()) | (s,y) <- fs, i <- [y+s, y+s+s..q]] diff --git a/Task/Sieve-of-Eratosthenes/Haskell/sieve-of-eratosthenes-4.hs b/Task/Sieve-of-Eratosthenes/Haskell/sieve-of-eratosthenes-4.hs index 48431cbef8..51c7d0cd11 100644 --- a/Task/Sieve-of-Eratosthenes/Haskell/sieve-of-eratosthenes-4.hs +++ b/Task/Sieve-of-Eratosthenes/Haskell/sieve-of-eratosthenes-4.hs @@ -1,10 +1,9 @@ -primes = _Y $ ((2:) . minus [3..] - . foldr (\x-> (x*x :) . union [x*x+x, x*x+2*x..]) []) +primesTo m = 2 : eratos [3,5..m] where + eratos (p : xs) | p*p>m = p : xs + | True = p : eratos (xs `minus` [p*p, p*p+2*p..m]) -_Y g = g (_Y g) -- non-sharing multistage fixpoint combinator --- = let x = g x in g x -- sharing two-stage fixpoint combinator - -union a@(x:xs) b@(y:ys) = case compare x y of - LT -> x : union xs b - EQ -> x : union xs ys - GT -> y : union a ys +minus a@(x:xs) b@(y:ys) = case compare x y of + LT -> x : minus xs b + EQ -> minus xs ys + GT -> minus a ys +minus a b = a diff --git a/Task/Sieve-of-Eratosthenes/Haskell/sieve-of-eratosthenes-5.hs b/Task/Sieve-of-Eratosthenes/Haskell/sieve-of-eratosthenes-5.hs index 6d00fb4d1b..48431cbef8 100644 --- a/Task/Sieve-of-Eratosthenes/Haskell/sieve-of-eratosthenes-5.hs +++ b/Task/Sieve-of-Eratosthenes/Haskell/sieve-of-eratosthenes-5.hs @@ -1,11 +1,10 @@ -primes :: [Integer] -primes = 2 : _Y g - where - g xs = 3 : gaps 5 (unionAll [[p*p, p*p+2*p..] | p <- xs]) +primes = _Y $ ((2:) . minus [3..] + . foldr (\x-> (x*x :) . union [x*x+x, x*x+2*x..]) []) -gaps k s@(x:xs) | k < x = k:gaps (k+2) s -- [k,k+2..]`minus`s, k<=x - | otherwise = gaps (k+2) xs -- && null(s`minus`[k,k+2..]) +_Y g = g (_Y g) -- non-sharing multistage fixpoint combinator +-- = let x = g x in g x -- sharing two-stage fixpoint combinator -unionAll ((x:xs):t) = x : (union xs . unionAll . pairs) t - where - pairs ((x:xs):ys:t) = (x : union xs ys) : pairs t +union a@(x:xs) b@(y:ys) = case compare x y of + LT -> x : union xs b + EQ -> x : union xs ys + GT -> y : union a ys diff --git a/Task/Sieve-of-Eratosthenes/Haskell/sieve-of-eratosthenes-6.hs b/Task/Sieve-of-Eratosthenes/Haskell/sieve-of-eratosthenes-6.hs new file mode 100644 index 0000000000..ec753807e2 --- /dev/null +++ b/Task/Sieve-of-Eratosthenes/Haskell/sieve-of-eratosthenes-6.hs @@ -0,0 +1,9 @@ +primes :: [Int] +primes = 2 : _Y ((3 :) . gaps 5 . _U . map(\p-> [p*p, p*p+2*p..])) + +gaps k s@(x:xs) | k < x = k : gaps (k+2) s -- ~= ([k,k+2..] \\ s), when + | otherwise = gaps (k+2) xs -- k<=x && null(s \\ [k,k+2..]) + +_U ((x:xs):t) = x : (union xs . _U . pairs) t -- ~= nub . sort . concat + where + pairs (xs:ys:t) = union xs ys : pairs t diff --git a/Task/Sieve-of-Eratosthenes/Perl/sieve-of-eratosthenes-9.pl b/Task/Sieve-of-Eratosthenes/Perl/sieve-of-eratosthenes-9.pl new file mode 100644 index 0000000000..73dff3b16f --- /dev/null +++ b/Task/Sieve-of-Eratosthenes/Perl/sieve-of-eratosthenes-9.pl @@ -0,0 +1,106 @@ +use strict; +use warnings; +package Tie::SieveOfEratosthenes; + +sub TIEARRAY { + my $class = shift; + bless \$class, $class; +} + +# If set to true, produces copious output. Observing this output +# is an excellent way to gain insight into how the algorithm works. +use constant DEBUG => 0; + +# If set to true, causes the code to skip over even numbers, +# improving runtime. It does not alter the output content, only the speed. +use constant WHEEL2 => 0; + +BEGIN { + + # This is loosely based on the Python implementation of this task, + # specifically the "Infinite generator with a faster algorithm" + + my @primes = (2, 3); + my $ps = WHEEL2 ? 1 : 0; + my $p = $primes[$ps]; + my $q = $p*$p; + my $incr = WHEEL2 ? 2 : 1; + my $candidate = $primes[-1] + $incr; + my %sieve; + + print "Initial: p = $p, q = $q, candidate = $candidate\n" if DEBUG; + + sub FETCH { + my $n = pop; + return if $n < 0; + return $primes[$n] if $n <= $#primes; + OUTER: while( 1 ) { + + # each key in %sieve is a composite number between + # p and p-squared. Each value in %sieve is $incr x the prime + # which acted as a 'seed' for that key. We use the value + # to step through multiples of the seed-prime, until we find + # an empty slot in %sieve. + while( my $s = delete $sieve{$candidate} ) { + print "$candidate a multiple of ".($s/$incr).";\t\t" if DEBUG; + my $composite = $candidate + $s; + $composite += $s while exists $sieve{$composite}; + print "The next stored multiple of ".($s/$incr)." is $composite\n" if DEBUG; + $sieve{$composite} = $s; + $candidate += $incr; + } + + print "Candidate $candidate is not in sieve\n" if DEBUG; + + while( $candidate < $q ) { + print "$candidate is prime\n" if DEBUG; + push @primes, $candidate; + $candidate += $incr; + next OUTER if exists $sieve{$candidate}; + } + + die "Candidate = $candidate, p = $p, q = $q" if $candidate > $q; + print "Candidate $candidate is equal to $p squared;\t" if DEBUG; + + # Thus, it is now time to add p to the sieve, + my $step = $incr * $p; + my $composite = $q + $step; + $composite += $step while exists $sieve{$composite}; + print "The next multiple of $p is $composite\n" if DEBUG; + $sieve{$composite} = $step; + + # and fetch out a new value for p from our primes array. + $p = $primes[++$ps]; + $q = $p * $p; + + # And since $candidate was equal to some prime squared, + # it's obviously composite, and we need to increment it. + $candidate += $incr; + print "p is $p, q is $q, candidate is $candidate\n" if DEBUG; + } continue { + return $primes[$n] if $n <= $#primes; + } + } + +} + +if( !caller ) { + tie my (@prime_list), 'Tie::SieveOfEratosthenes'; + my $limit = $ARGV[0] || 100; + my $line = ""; + for( my $count = 0; $prime_list[$count] < $limit; ++$count ) { + $line .= $prime_list[$count]. ", "; + next if length($line) <= 70; + if( $line =~ tr/,// > 1 ) { + $line =~ s/^(.*,) (.*, )/$2/; + print $1, "\n"; + } else { + print $line, "\n"; + $line = ""; + } + } + $line =~ s/, \z//; + print $line, "\n" if $line; +} + +1; diff --git a/Task/Sieve-of-Eratosthenes/Prolog/sieve-of-eratosthenes-1.pro b/Task/Sieve-of-Eratosthenes/Prolog/sieve-of-eratosthenes-1.pro index be0cc99ee3..85f34ef187 100644 --- a/Task/Sieve-of-Eratosthenes/Prolog/sieve-of-eratosthenes-1.pro +++ b/Task/Sieve-of-Eratosthenes/Prolog/sieve-of-eratosthenes-1.pro @@ -1,22 +1,35 @@ -sieve(N, [2|PS]) :- % PS is list of odd primes up to N - retractall(mult(_)), - sieve_O(3,N,PS). +% %sieve( +N, -Primes ) is true if Primes is the list of consecutive primes +% that are less than or equal to N +sieve( N, [2|Rest]) :- + retractall( composite(_) ), + sieve( N, 2, Rest ) -> true. % only one solution -sieve_O(I,N,PS) :- % sieve odds from I up to N to get PS - I =< N, !, I1 is I+2, - ( mult(I) -> sieve_O(I1,N,PS) - ; ( I =< N / I -> - ISq is I*I, DI is 2*I, add_mults(DI,ISq,N) - ; true - ), - PS = [I|T], - sieve_O(I1,N,T) - ). -sieve_O(I,N,[]) :- I > N. +% sieve P, find the next non-prime, and then recurse: +sieve( N, P, [I|Rest] ) :- + sieve_once(P, N), + (P = 2 -> P2 is P+1; P2 is P+2), + between(P2, N, I), + (composite(I) -> fail; sieve( N, I, Rest )). -add_mults(DI,I,N) :- - I =< N, !, - ( mult(I) -> true ; assert(mult(I)) ), - I1 is I+DI, - add_mults(DI,I1,N). -add_mults(_,I,N) :- I > N. +% It is OK if there are no more primes less than or equal to N: +sieve( N, P, [] ). + +sieve_once(P, N) :- + forall( between(P, N, P, IP), + (composite(IP) -> true ; assertz( composite(IP) )) ). + + +% To avoid division, we use the iterator +% between(+Min, +Max, +By, -I) +% where we assume that By > 0 +% This is like "for(I=Min; I <= Max; I+=By)" in C. +between(Min, Max, By, I) :- + Min =< Max, + A is Min + By, + (I = Min; between(A, Max, By, I) ). + + +% Some Prolog implementations require the dynamic predicates be +% declared: + +:- dynamic( composite/1 ). diff --git a/Task/Sieve-of-Eratosthenes/Prolog/sieve-of-eratosthenes-2.pro b/Task/Sieve-of-Eratosthenes/Prolog/sieve-of-eratosthenes-2.pro index 3405beff59..20589c0335 100644 --- a/Task/Sieve-of-Eratosthenes/Prolog/sieve-of-eratosthenes-2.pro +++ b/Task/Sieve-of-Eratosthenes/Prolog/sieve-of-eratosthenes-2.pro @@ -1,26 +1,7 @@ -?- use_module(library(heaps)). +% SWI-Prolog: -prime(2). -prime(N) :- prime_heap(N, _). - -prime_heap(3, H) :- list_to_heap([9-6], H). -prime_heap(N, H) :- - prime_heap(M, H0), N0 is M + 2, - next_prime(N0, H0, N, H). - -next_prime(N0, H0, N, H) :- - \+ min_of_heap(H0, N0, _), - N = N0, Composite is N*N, Skip is N+N, - add_to_heap(H0, Composite, Skip, H). -next_prime(N0, H0, N, H) :- - min_of_heap(H0, N0, _), - adjust_heap(H0, N0, H1), N1 is N0 + 2, - next_prime(N1, H1, N, H). - -adjust_heap(H0, N, H) :- - min_of_heap(H0, N, _), - get_from_heap(H0, N, Skip, H1), - Composite is N + Skip, add_to_heap(H1, Composite, Skip, H2), - adjust_heap(H2, N, H). -adjust_heap(H, N, H) :- - \+ min_of_heap(H, N, _). +?- time( (sieve(100000,P), length(P,N), writeln(N), last(P, LP), writeln(LP) )). +% 1,323,159 inferences, 0.862 CPU in 0.921 seconds (94% CPU, 1534724 Lips) +P = [2, 3, 5, 7, 11, 13, 17, 19, 23|...], +N = 9592, +LP = 99991. diff --git a/Task/Sieve-of-Eratosthenes/Prolog/sieve-of-eratosthenes-3.pro b/Task/Sieve-of-Eratosthenes/Prolog/sieve-of-eratosthenes-3.pro new file mode 100644 index 0000000000..be0cc99ee3 --- /dev/null +++ b/Task/Sieve-of-Eratosthenes/Prolog/sieve-of-eratosthenes-3.pro @@ -0,0 +1,22 @@ +sieve(N, [2|PS]) :- % PS is list of odd primes up to N + retractall(mult(_)), + sieve_O(3,N,PS). + +sieve_O(I,N,PS) :- % sieve odds from I up to N to get PS + I =< N, !, I1 is I+2, + ( mult(I) -> sieve_O(I1,N,PS) + ; ( I =< N / I -> + ISq is I*I, DI is 2*I, add_mults(DI,ISq,N) + ; true + ), + PS = [I|T], + sieve_O(I1,N,T) + ). +sieve_O(I,N,[]) :- I > N. + +add_mults(DI,I,N) :- + I =< N, !, + ( mult(I) -> true ; assert(mult(I)) ), + I1 is I+DI, + add_mults(DI,I1,N). +add_mults(_,I,N) :- I > N. diff --git a/Task/Sieve-of-Eratosthenes/Prolog/sieve-of-eratosthenes-4.pro b/Task/Sieve-of-Eratosthenes/Prolog/sieve-of-eratosthenes-4.pro new file mode 100644 index 0000000000..3405beff59 --- /dev/null +++ b/Task/Sieve-of-Eratosthenes/Prolog/sieve-of-eratosthenes-4.pro @@ -0,0 +1,26 @@ +?- use_module(library(heaps)). + +prime(2). +prime(N) :- prime_heap(N, _). + +prime_heap(3, H) :- list_to_heap([9-6], H). +prime_heap(N, H) :- + prime_heap(M, H0), N0 is M + 2, + next_prime(N0, H0, N, H). + +next_prime(N0, H0, N, H) :- + \+ min_of_heap(H0, N0, _), + N = N0, Composite is N*N, Skip is N+N, + add_to_heap(H0, Composite, Skip, H). +next_prime(N0, H0, N, H) :- + min_of_heap(H0, N0, _), + adjust_heap(H0, N0, H1), N1 is N0 + 2, + next_prime(N1, H1, N, H). + +adjust_heap(H0, N, H) :- + min_of_heap(H0, N, _), + get_from_heap(H0, N, Skip, H1), + Composite is N + Skip, add_to_heap(H1, Composite, Skip, H2), + adjust_heap(H2, N, H). +adjust_heap(H, N, H) :- + \+ min_of_heap(H, N, _). diff --git a/Task/Sieve-of-Eratosthenes/Python/sieve-of-eratosthenes-1.py b/Task/Sieve-of-Eratosthenes/Python/sieve-of-eratosthenes-1.py index e5ff7b8cce..428f0fe486 100644 --- a/Task/Sieve-of-Eratosthenes/Python/sieve-of-eratosthenes-1.py +++ b/Task/Sieve-of-Eratosthenes/Python/sieve-of-eratosthenes-1.py @@ -3,7 +3,6 @@ def eratosthenes(n): for i in xrange(2, n+1): if i not in multiples: print i - for j in xrange(i*i, n+1, i): - multiples.append(j) + multiples.extend(xrange(i*i, n+1, i)) eratosthenes(100) diff --git a/Task/Sieve-of-Eratosthenes/REXX/sieve-of-eratosthenes-2.rexx b/Task/Sieve-of-Eratosthenes/REXX/sieve-of-eratosthenes-2.rexx index f62971cfdc..be54767a5d 100644 --- a/Task/Sieve-of-Eratosthenes/REXX/sieve-of-eratosthenes-2.rexx +++ b/Task/Sieve-of-Eratosthenes/REXX/sieve-of-eratosthenes-2.rexx @@ -2,11 +2,14 @@ parse arg H .; if H=='' then H=200 /*high# can be specified on C.L. */ tell=h>0; H=abs(H); w=length(H) /*neg H suppresses prime listing.*/ if 2<=H & tell then say right(1,w+20)'st prime ───► ' right(2,w) +skip=0 /*skips top part sieve striking. */ @.=1 /*assume all numbers are prime. */ #=1 /*number of primes found so far. */ do j=3 by 2 to H /*odd integers up to H inclusive.*/ if @.j then do; #=#+1 /*Prime? Then bump prime counter*/ if tell then say right(#,w+20)th(#) 'prime ───► ' right(j,w) + if skip then iterate /*should the top part be skipped?*/ + if j*j>H then skip=1 /*indicate skipping if j > √ H. */ do m=j*j to H by j+j; @.m=0; end /*odd multiples.*/ end /*plain*/ /*[↑] strike odd multiples ¬prime*/ end /*j*/ diff --git a/Task/Sieve-of-Eratosthenes/REXX/sieve-of-eratosthenes-3.rexx b/Task/Sieve-of-Eratosthenes/REXX/sieve-of-eratosthenes-3.rexx index d62b58ae9a..aa9d70aab9 100644 --- a/Task/Sieve-of-Eratosthenes/REXX/sieve-of-eratosthenes-3.rexx +++ b/Task/Sieve-of-Eratosthenes/REXX/sieve-of-eratosthenes-3.rexx @@ -2,11 +2,15 @@ parse arg H .; if H=='' then H=200 /*high# can be specified on C.L. */ w=length(H); prime=right('prime',20) /*W is used for formatting output*/ if 2<=H then say prime right(1,w) " ───► " right(2,w) +skip=0 /*skips top part sieve striking. */ @.=1 /*assume all numbers are prime. */ #=1 /*number of primes found so far. */ - do j=3 by 2 to H /*odd integers up to H inclusive.*/ - if @.j then do; #=#+1 /*Prime? Then bump prime counter*/ - do m=j*j to H by j+j; @.m=0; end /*odd multiples.*/ - end /*plain*/ /*[↑] strike odd multiples ¬prime*/ - end /*j*/ + do j=3 by 2 to H /*odd integers up to H inclusive.*/ + if @.j then do; #=#+1 /*Prime? Then bump prime counter*/ + say prime right(#,w) " ───► " right(j,w) /*show.*/ + if skip then iterate /*should the top part be skipped?*/ + if j*j>H then skip=1 /*indicate skipping if j > √ H. */ + do m=j*j to H by j+j; @.m=0; end /*odd multiples.*/ + end /*plain*/ /*[↑] strike odd multiples ¬prime*/ + end /*j*/ /*stick a fork in it, we're done.*/ diff --git a/Task/Sieve-of-Eratosthenes/Scala/sieve-of-eratosthenes-1.scala b/Task/Sieve-of-Eratosthenes/Scala/sieve-of-eratosthenes-1.scala index f29caef557..ea512ca99b 100644 --- a/Task/Sieve-of-Eratosthenes/Scala/sieve-of-eratosthenes-1.scala +++ b/Task/Sieve-of-Eratosthenes/Scala/sieve-of-eratosthenes-1.scala @@ -1,10 +1,10 @@ def sieveOfEratosthenes(nTo: Int) = { - val primes = collection.mutable.BitSet.empty.par ++ (2 to nTo) + val primes = collection.mutable.BitSet.empty.par ++ (2 +: (3 to nTo by 2)) for { - candidate <- 2 until Math.sqrt(nTo).toInt + candidate <- 3 until Math.sqrt(nTo).toInt if primes contains candidate } primes --= candidate * candidate to nTo by candidate primes } -// An effect of parallel processing cause the result is shuffled. +// BitSet toList is shuffled. println(sieveOfEratosthenes(101).toList.sorted) diff --git a/Task/Sieve-of-Eratosthenes/Scala/sieve-of-eratosthenes-3.scala b/Task/Sieve-of-Eratosthenes/Scala/sieve-of-eratosthenes-3.scala index 354793b6a6..11c3d3277c 100644 --- a/Task/Sieve-of-Eratosthenes/Scala/sieve-of-eratosthenes-3.scala +++ b/Task/Sieve-of-Eratosthenes/Scala/sieve-of-eratosthenes-3.scala @@ -2,7 +2,7 @@ import scala.language.postfixOps def sieve(nums: Stream[Int]): Stream[Int] = Stream.cons(nums.head, sieve((nums.tail) filter (_ % nums.head != 0))) - val primes = sieve(2 #:: Stream.from(3, 2)) + val primes = 2 #:: sieve(Stream.from(3, 2)) println(primes take 10 toList) // //List(2, 3, 5, 7, 11, 13, 17, 19, 23, 29) println(primes takeWhile (_ < 30) toList) //List(2, 3, 5, 7, 11, 13, 17, 19, 23, 29) diff --git a/Task/Simple-database/C/simple-database.c b/Task/Simple-database/C/simple-database.c index 4d2894e353..10fc933f0a 100644 --- a/Task/Simple-database/C/simple-database.c +++ b/Task/Simple-database/C/simple-database.c @@ -28,7 +28,7 @@ static time_t str2time (char *date); /* qsort callbacks */ sort_by(last_name); sort_by(title); -static sort by_date; +static int by_date(pdb_t *p1, pdb_t *p2); /* main */ int main (int argc, char **argv) { char buf[100]; @@ -76,7 +76,7 @@ usage: printf ("Usage: %s [commands]\n" case DATE: printf ("-d Print all entries sorted by date.\n"); dblist = dao (READ,f,&db,NULL); - dblist = dao (SORT,f,dblist,by_date); + dblist = dao (SORT,f,dblist,(int (*)(const void *,const void *)) by_date); dao (PRINT,f,dblist,NULL); dao (DESTROY,f,dblist,NULL); break; @@ -155,7 +155,7 @@ static pdb_t dao (int cmd, FILE *f, pdb_t in_db, sort sortby) { } qsort (pdb,i,sizeof in_db,sortby); pdb[i-1]->next=NULL; - for (;i;i--) { + for (i=i-1;i;i--) { pdb[i-1]->next=pdb[i]; } rec=pdb[0]; diff --git a/Task/Simple-windowed-application/Objective-C/simple-windowed-application-1.m b/Task/Simple-windowed-application/Objective-C/simple-windowed-application-1.m index f7a6f90a2f..544198065c 100644 --- a/Task/Simple-windowed-application/Objective-C/simple-windowed-application-1.m +++ b/Task/Simple-windowed-application/Objective-C/simple-windowed-application-1.m @@ -3,9 +3,9 @@ @interface ClickMe : NSWindow { - NSButton *button; - NSTextField *text; - int counter; + NSButton *_button; + NSTextField *_text; + int _counter; } - (void)applicationDidFinishLaunching: (NSNotification *)notification; - (BOOL)applicationShouldTerminateAfterLastWindowClosed: (NSNotification *)notification; diff --git a/Task/Simple-windowed-application/Objective-C/simple-windowed-application-2.m b/Task/Simple-windowed-application/Objective-C/simple-windowed-application-2.m index fdc6b77723..47c35efb50 100644 --- a/Task/Simple-windowed-application/Objective-C/simple-windowed-application-2.m +++ b/Task/Simple-windowed-application/Objective-C/simple-windowed-application-2.m @@ -1,19 +1,15 @@ @implementation ClickMe : NSWindow --(id) init +-(instancetype) init { - NSRect buttonRect; - int totalWindowHeight; - - counter = 0; - button = [[NSButton alloc] init]; + NSButton *button = [[NSButton alloc] init]; [button setButtonType: NSToggleButton]; [button setTitle: @"Click Me"]; [button sizeToFit]; [button setTarget: self]; [button setAction: @selector(advanceCounter:)]; - buttonRect = [button frame]; + NSRect buttonRect = [button frame]; - text = [[NSTextField alloc] + NSTextField *text = [[NSTextField alloc] initWithFrame: NSMakeRect(buttonRect.origin.x, buttonRect.size.height, buttonRect.size.width, buttonRect.size.height)]; [text setAlignment: NSCenterTextAlignment]; @@ -25,32 +21,27 @@ [button setFrameSize: NSMakeSize( [text frame].size.width, buttonRect.size.height ) ]; - totalWindowHeight = buttonRect.size.height + [text frame].size.height; + int totalWindowHeight = buttonRect.size.height + [text frame].size.height; - [self - initWithContentRect: NSMakeRect(100, 100, + if ((self = [super initWithContentRect: NSMakeRect(100, 100, [text frame].size.width, totalWindowHeight) - styleMask: (NSTitledWindowMask | NSClosableWindowMask) - backing: NSBackingStoreBuffered - defer: NO]; + styleMask: (NSTitledWindowMask | NSClosableWindowMask) + backing: NSBackingStoreBuffered + defer: NO])) { + _counter = 0; + _button = button; + _text = text; - [[self contentView] addSubview: text]; [text release]; - [[self contentView] addSubview: button]; [button release]; - - [self setTitle: @"Click Me!"]; - [self center]; + [[self contentView] addSubview: _text]; + [[self contentView] addSubview: _button]; + [self setTitle: @"Click Me!"]; + [self center]; + } return self; } --(void) dealloc -{ - [button release]; - [text release]; - [super dealloc]; -} - - (void)applicationDidFinishLaunching: (NSNotification *)notification { [self orderFront: self]; @@ -63,24 +54,18 @@ - (void)advanceCounter: (id)sender { - counter++; - [text setStringValue: [NSString stringWithFormat: @"Clicked %d times", counter]]; + [_text setStringValue: [NSString stringWithFormat: @"Clicked %d times", ++_counter]]; } @end int main() { - ClickMe *clickme; - NSAutoreleasePool *pool; - NSApplication *app; - - pool = [[NSAutoreleasePool alloc] init]; - app = [NSApplication sharedApplication]; - clickme = [[ClickMe alloc] init]; - [app setDelegate: clickme]; - [app run]; - [clickme release]; - [pool release]; + @autoreleasepool { + NSApplication *app = [NSApplication sharedApplication]; + ClickMe *clickme = [[ClickMe alloc] init]; + [app setDelegate: clickme]; + [app run]; + } return 0; } diff --git a/Task/Singleton/Perl-6/singleton.pl6 b/Task/Singleton/Perl-6/singleton.pl6 index b14e1c13c9..939ea54eb3 100644 --- a/Task/Singleton/Perl-6/singleton.pl6 +++ b/Task/Singleton/Perl-6/singleton.pl6 @@ -1,6 +1,6 @@ class Singleton { # We create a lexical variable in the class block that holds our single instance. - my Singleton $instance = Singleton.bless(*); # You can add initialization arguments here. + my Singleton $instance = Singleton.bless; # You can add initialization arguments here. method new {!!!} # Singleton.new dies. method instance { $instance; } } diff --git a/Task/Singly-linked-list-Element-definition/Objective-C/singly-linked-list-element-definition.m b/Task/Singly-linked-list-Element-definition/Objective-C/singly-linked-list-element-definition.m index 6f6122936a..818e885922 100644 --- a/Task/Singly-linked-list-Element-definition/Objective-C/singly-linked-list-element-definition.m +++ b/Task/Singly-linked-list-Element-definition/Objective-C/singly-linked-list-element-definition.m @@ -1,11 +1,10 @@ -#import +#import -@interface RCListElement : Object +@interface RCListElement : NSObject { RCListElement *next; id datum; } -+ (RCListElement *)new; - (RCListElement *)next; - (id)datum; - (RCListElement *)setNext: (RCListElement *)nx; @@ -13,13 +12,6 @@ @end @implementation RCListElement -+ (RCListElement *)new -{ - RCListElement *m = [super new]; - [m setNext: nil]; - [m setDatum: nil]; - return m; -} - (RCListElement *)next { return next; diff --git a/Task/Sleep/Maple/sleep.maple b/Task/Sleep/Maple/sleep.maple new file mode 100644 index 0000000000..b0ca13e21f --- /dev/null +++ b/Task/Sleep/Maple/sleep.maple @@ -0,0 +1,5 @@ +sleep := proc(secs) + print("Sleeping..."); + Threads:-Sleep(secs); + print("Awake!"); + end proc: diff --git a/Task/Sleep/Objective-C/sleep.m b/Task/Sleep/Objective-C/sleep.m index b5eb337822..259b8e5f19 100644 --- a/Task/Sleep/Objective-C/sleep.m +++ b/Task/Sleep/Objective-C/sleep.m @@ -2,16 +2,16 @@ int main() { - NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; - NSTimeInterval sleeptime; + @autoreleasepool { - printf("wait time in seconds: "); - scanf("%f", &sleeptime); + NSTimeInterval sleeptime; + printf("wait time in seconds: "); + scanf("%f", &sleeptime); - NSLog(@"sleeping..."); - [NSThread sleepForTimeInterval: sleeptime]; - NSLog(@"awakening..."); + NSLog(@"sleeping..."); + [NSThread sleepForTimeInterval: sleeptime]; + NSLog(@"awakening..."); - [pool release]; + } return 0; } diff --git a/Task/Solve-a-Hidato-puzzle/D/solve-a-hidato-puzzle-2.d b/Task/Solve-a-Hidato-puzzle/D/solve-a-hidato-puzzle-2.d index 0bf6486c89..a908d6971e 100644 --- a/Task/Solve-a-Hidato-puzzle/D/solve-a-hidato-puzzle-2.d +++ b/Task/Solve-a-Hidato-puzzle/D/solve-a-hidato-puzzle-2.d @@ -33,19 +33,19 @@ struct Hidato { cell == Hidato.unknownCell || (cell >= 1 && cell <= size)); if (cell > 0) - assert(i == known[cast(size_t)cell]); + assert(i == known[size_t(cell)]); } } body { bool[Cell] pathSeen; // A set. - /*immutable*/ const lines = input.splitLines; + immutable lines = input.splitLines; this.nRows = lines.length; this.nCols = lines[0].split.length; immutable size = nCols * nRows; - this.board = new typeof(this.board[0])[size]; + this.board.length = size; this.board[] = emptyCell; - this.known = new typeof(this.known[0])[size + 1]; - this.flood = new typeof(this.flood[0])[size]; + this.known.length = size + 1; + this.flood.length = size; auto boardMaxMutable = Cell.min; Pos i = 0; diff --git a/Task/Solve-a-Hidato-puzzle/Ruby/solve-a-hidato-puzzle-1.rb b/Task/Solve-a-Hidato-puzzle/Ruby/solve-a-hidato-puzzle-1.rb index 6010baeaa0..964737282b 100644 --- a/Task/Solve-a-Hidato-puzzle/Ruby/solve-a-hidato-puzzle-1.rb +++ b/Task/Solve-a-Hidato-puzzle/Ruby/solve-a-hidato-puzzle-1.rb @@ -3,7 +3,6 @@ # Nigel_Galloway # May 5th., 2012. class Cell - def self.[](*args) self.new(*args) end def initialize(row=0, col=0, value=nil) @adj = [[row-1,col-1],[row,col-1],[row+1,col-1],[row-1,col],[row+1,col],[row-1,col+1],[row,col+1],[row+1,col+1]] @t = false @@ -27,3 +26,40 @@ class Cell end attr_reader :value end + +class Hidato + def initialize(board, pout=true) + $end = 0 + $zbl = [] + $board = [] + board.each_line.with_index do |line, x| + $board << line.split.each_with_index.map do |n,y| + begin + n = Integer(n) + @sx, @sy = x, y if n == 1 # start position + $end += 1 + Cell.new(x, y, n) + rescue + Cell.new # frame (Sentinel value) + end + end + end + @xmax = $board.size - 2 + @ymax = $board[1].size - 2 + printout('Problem:') if pout + end + def solve + if $board[@sx][@sy].try(1) + printout('Solution:') + else + puts "no solution" + end + end + def printout(msg=nil) + puts msg if msg + (1..@xmax).each do |x| + puts (1..@ymax).map{|y| "%3s" % $board[x][y].value}.join + end + puts + end +end diff --git a/Task/Solve-a-Hidato-puzzle/Ruby/solve-a-hidato-puzzle-2.rb b/Task/Solve-a-Hidato-puzzle/Ruby/solve-a-hidato-puzzle-2.rb index 3a622b83f2..675ade4603 100644 --- a/Task/Solve-a-Hidato-puzzle/Ruby/solve-a-hidato-puzzle-2.rb +++ b/Task/Solve-a-Hidato-puzzle/Ruby/solve-a-hidato-puzzle-2.rb @@ -1,15 +1,36 @@ -require 'benchmark' +# Which may be used as follows to solve Evil Case 1: +board1 = < $end + return false if @t + return false if @value > 0 and @value != value + return false if @value == 0 and $zbl[value] + @t = true + h = Hash.new + @adj.each_with_index do |(x,y), n| + cell = $board[x][y] + h[cell.wdof*10+n] = cell if cell.value + end + h.sort.each do |key, cell| + if (cell.try(value+1)) + @value = value + return true + end + end + @t = false + end + def wdon + (@value.nil? or @value > 0 or @t) ? 0 : 1 + end + def wdof + @adj.inject(0){|res, (x,y)| res += $board[x][y].wdon} + end + attr_reader :value +end diff --git a/Task/Sort-an-array-of-composite-structures/Objective-C/sort-an-array-of-composite-structures.m b/Task/Sort-an-array-of-composite-structures/Objective-C/sort-an-array-of-composite-structures.m index 30111a0286..0559eb5cb2 100644 --- a/Task/Sort-an-array-of-composite-structures/Objective-C/sort-an-array-of-composite-structures.m +++ b/Task/Sort-an-array-of-composite-structures/Objective-C/sort-an-array-of-composite-structures.m @@ -2,28 +2,23 @@ NSString *name; NSString *value; } -+(id)pairWithName:(NSString *)n value:(NSString *)v; --(id)initWithName:(NSString *)n value:(NSString *)v; ++(instancetype)pairWithName:(NSString *)n value:(NSString *)v; +-(instancetype)initWithName:(NSString *)n value:(NSString *)v; -(NSString *)name; -(NSString *)value; @end @implementation Pair -+(id)pairWithName:(NSString *)n value:(NSString *)v { - return [[[self alloc] initWithName:n value:v] autorelease]; ++(instancetype)pairWithName:(NSString *)n value:(NSString *)v { + return [[self alloc] initWithName:n value:v]; } --(id)initWithName:(NSString *)n value:(NSString *)v { +-(instancetype)initWithName:(NSString *)n value:(NSString *)v { if ((self = [super init])) { - name = [n retain]; - value = [v retain]; + name = n; + value = v; } return self; } --(void)dealloc { - [name release]; - [value release]; - [super dealloc]; -} -(NSString *)name { return name; } -(NSString *)value { return value; } -(NSString *)description { @@ -32,9 +27,9 @@ @end int main() { - NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; + @autoreleasepool { - NSArray *pairs = [NSArray arrayWithObjects: + NSArray *pairs = @[ [Pair pairWithName:@"06-07" value:@"Ducks"], [Pair pairWithName:@"00-01" value:@"Avalanche"], [Pair pairWithName:@"02-03" value:@"Devils"], @@ -44,21 +39,17 @@ int main() { [Pair pairWithName:@"05-06" value:@"Hurricanes"], [Pair pairWithName:@"99-00" value:@"Devils"], [Pair pairWithName:@"07-08" value:@"Red Wings"], - [Pair pairWithName:@"08-09" value:@"Penguins"], - nil]; + [Pair pairWithName:@"08-09" value:@"Penguins"]]; - // optional 3rd arg: you can also specify a selector to compare the keys - NSSortDescriptor *sd = [[NSSortDescriptor alloc] initWithKey:@"name" ascending:YES]; + // optional 3rd arg: you can also specify a selector to compare the keys + NSSortDescriptor *sd = [[NSSortDescriptor alloc] initWithKey:@"name" ascending:YES]; - // it takes an array of sort descriptors, and it will be ordered by the - // first one, then if it's a tie by the second one, etc. - NSArray *sorted = [pairs sortedArrayUsingDescriptors: - [NSArray arrayWithObject:sd]]; - NSLog(@"%@", sorted); + // it takes an array of sort descriptors, and it will be ordered by the + // first one, then if it's a tie by the second one, etc. + NSArray *sorted = [pairs sortedArrayUsingDescriptors:@[sd]]; + NSLog(@"%@", sorted); - [sd release]; - - [pool release]; + } return 0; } diff --git a/Task/Sort-an-integer-array/Maple/sort-an-integer-array.maple b/Task/Sort-an-integer-array/Maple/sort-an-integer-array.maple new file mode 100644 index 0000000000..73df928865 --- /dev/null +++ b/Task/Sort-an-integer-array/Maple/sort-an-integer-array.maple @@ -0,0 +1,2 @@ +sort([5,7,8,3,6,1]); +sort(Array([5,7,8,3,6,1])) diff --git a/Task/Sort-an-integer-array/Objective-C/sort-an-integer-array.m b/Task/Sort-an-integer-array/Objective-C/sort-an-integer-array.m index 4a7c636f01..5b8f2eb226 100644 --- a/Task/Sort-an-integer-array/Objective-C/sort-an-integer-array.m +++ b/Task/Sort-an-integer-array/Objective-C/sort-an-integer-array.m @@ -1,12 +1,2 @@ -- (void)example -{ - NSArray *nums, *sorted; - nums = [NSArray arrayWithObjects: - [NSNumber numberWithInt:2], - [NSNumber numberWithInt:4], - [NSNumber numberWithInt:3], - [NSNumber numberWithInt:1], - [NSNumber numberWithInt:2], - nil]; - sorted = [nums sortedArrayUsingSelector:@selector(compare:)]; -} +NSArray *nums = @[@2, @4, @3, @1, @2]; +NSArray *sorted = [nums sortedArrayUsingSelector:@selector(compare:)]; diff --git a/Task/Sort-disjoint-sublist/Objective-C/sort-disjoint-sublist.m b/Task/Sort-disjoint-sublist/Objective-C/sort-disjoint-sublist.m index 4b8dd6c7c7..8ae1602586 100644 --- a/Task/Sort-disjoint-sublist/Objective-C/sort-disjoint-sublist.m +++ b/Task/Sort-disjoint-sublist/Objective-C/sort-disjoint-sublist.m @@ -5,13 +5,13 @@ int *indexes; int num_indexes; } -- (id)initWithArray:(NSMutableArray *)a andIndexes:(NSIndexSet *)ind; +- (instancetype)initWithArray:(NSMutableArray *)a andIndexes:(NSIndexSet *)ind; @end @implementation DisjointSublistView -- (id)initWithArray:(NSMutableArray *)a andIndexes:(NSIndexSet *)ind { +- (instancetype)initWithArray:(NSMutableArray *)a andIndexes:(NSIndexSet *)ind { if ((self = [super init])) { - array = [a retain]; + array = a; num_indexes = [ind count]; indexes = malloc(num_indexes * sizeof(int)); for (NSUInteger i = [ind firstIndex], j = 0; i != NSNotFound; i = [ind indexGreaterThanIndex:i], j++) @@ -20,14 +20,11 @@ return self; } - (void)dealloc { - [array release]; free(indexes); - [super dealloc]; } - (NSUInteger)count { return num_indexes; } -- (id)objectAtIndex:(NSUInteger)i { return [array objectAtIndex:indexes[i]]; } -- (void)replaceObjectAtIndex:(NSUInteger)i withObject:(id)x { - return [array replaceObjectAtIndex:indexes[i] withObject:x]; } +- (id)objectAtIndex:(NSUInteger)i { return array[indexes[i]]; } +- (void)replaceObjectAtIndex:(NSUInteger)i withObject:(id)x { array[indexes[i]] = x; } @end @interface NSMutableArray (SortDisjoint) @@ -37,28 +34,18 @@ - (void)sortDisjointSublist:(NSIndexSet *)indexes usingSelector:(SEL)comparator { DisjointSublistView *d = [[DisjointSublistView alloc] initWithArray:self andIndexes:indexes]; [d sortUsingSelector:comparator]; - [d release]; } @end int main(int argc, const char *argv[]) { - NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; + @autoreleasepool { - NSMutableArray *a = [NSMutableArray arrayWithObjects: - [NSNumber numberWithInt:7], - [NSNumber numberWithInt:6], - [NSNumber numberWithInt:5], - [NSNumber numberWithInt:4], - [NSNumber numberWithInt:3], - [NSNumber numberWithInt:2], - [NSNumber numberWithInt:1], - [NSNumber numberWithInt:0], - nil]; - NSMutableIndexSet *ind = [NSMutableIndexSet indexSet]; - [ind addIndex:6]; [ind addIndex:1]; [ind addIndex:7]; - [a sortDisjointSublist:ind usingSelector:@selector(compare:)]; - NSLog(@"%@", a); + NSMutableArray *a = [@[@7, @6, @5, @4, @3, @2, @1, @0] mutableCopy]; + NSMutableIndexSet *ind = [NSMutableIndexSet indexSet]; + [ind addIndex:6]; [ind addIndex:1]; [ind addIndex:7]; + [a sortDisjointSublist:ind usingSelector:@selector(compare:)]; + NSLog(@"%@", a); - [pool release]; + } return 0; } diff --git a/Task/Sort-using-a-custom-comparator/Objective-C/sort-using-a-custom-comparator-1.m b/Task/Sort-using-a-custom-comparator/Objective-C/sort-using-a-custom-comparator-1.m index 2139172286..87cbdd7b97 100644 --- a/Task/Sort-using-a-custom-comparator/Objective-C/sort-using-a-custom-comparator-1.m +++ b/Task/Sort-using-a-custom-comparator/Objective-C/sort-using-a-custom-comparator-1.m @@ -4,25 +4,25 @@ int main() { - NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; + @autoreleasepool { - NSMutableArray *arr = - [NSMutableArray - arrayWithArray: [@"this is a set of strings to sort" - componentsSeparatedByString: @" "] - ]; + NSMutableArray *arr = + [NSMutableArray + arrayWithArray: [@"this is a set of strings to sort" + componentsSeparatedByString: @" "] + ]; - [arr sortUsingComparator: ^NSComparisonResult(id obj1, id obj2){ - NSComparisonResult l = esign((int)([obj1 length] - [obj2 length])); - return l ? -l // reverse the ordering - : [obj1 caseInsensitiveCompare: obj2]; - }]; + [arr sortUsingComparator: ^NSComparisonResult(id obj1, id obj2){ + NSComparisonResult l = esign((int)([obj1 length] - [obj2 length])); + return l ? -l // reverse the ordering + : [obj1 caseInsensitiveCompare: obj2]; + }]; + + for( NSString *str in arr ) + { + NSLog(@"%@", str); + } - for( NSString *str in arr ) - { - NSLog(@"%@", str); } - - [pool release]; return EXIT_SUCCESS; } diff --git a/Task/Sort-using-a-custom-comparator/Objective-C/sort-using-a-custom-comparator-2.m b/Task/Sort-using-a-custom-comparator/Objective-C/sort-using-a-custom-comparator-2.m index 7f785c63d6..5fe3f7c30b 100644 --- a/Task/Sort-using-a-custom-comparator/Objective-C/sort-using-a-custom-comparator-2.m +++ b/Task/Sort-using-a-custom-comparator/Objective-C/sort-using-a-custom-comparator-2.m @@ -16,23 +16,21 @@ int main() { - NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; + @autoreleasepool { - NSMutableArray *arr = - [NSMutableArray - arrayWithArray: [@"this is a set of strings to sort" - componentsSeparatedByString: @" "] - ]; + NSMutableArray *arr = + [NSMutableArray + arrayWithArray: [@"this is a set of strings to sort" + componentsSeparatedByString: @" "] + ]; - [arr sortUsingSelector: @selector(my_compare:)]; + [arr sortUsingSelector: @selector(my_compare:)]; + + for ( NSString *str in arr ) + { + NSLog(@"%@", str); + } - NSEnumerator *iter = [arr objectEnumerator]; - NSString *str; - while( (str = [iter nextObject]) != nil ) - { - NSLog(@"%@", str); } - - [pool release]; return EXIT_SUCCESS; } diff --git a/Task/Sort-using-a-custom-comparator/Objective-C/sort-using-a-custom-comparator-3.m b/Task/Sort-using-a-custom-comparator/Objective-C/sort-using-a-custom-comparator-3.m index 788f0774db..c3c120e68c 100644 --- a/Task/Sort-using-a-custom-comparator/Objective-C/sort-using-a-custom-comparator-3.m +++ b/Task/Sort-using-a-custom-comparator/Objective-C/sort-using-a-custom-comparator-3.m @@ -2,21 +2,17 @@ int main() { - NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; + @autoreleasepool { - NSArray *strings = [@"Here are some sample strings to be sorted" componentsSeparatedByString:@" "]; + NSArray *strings = [@"Here are some sample strings to be sorted" componentsSeparatedByString:@" "]; - NSSortDescriptor *sd1 = [[NSSortDescriptor alloc] initWithKey:@"length" ascending:NO]; - NSSortDescriptor *sd2 = [[NSSortDescriptor alloc] initWithKey:@"lowercaseString" ascending:YES]; + NSSortDescriptor *sd1 = [[NSSortDescriptor alloc] initWithKey:@"length" ascending:NO]; + NSSortDescriptor *sd2 = [[NSSortDescriptor alloc] initWithKey:@"lowercaseString" ascending:YES]; - NSArray *sortDescriptors = [NSArray arrayWithObjects:sd1, sd2, nil]; - [sd1 release]; - [sd2 release]; + NSArray *sorted = [strings sortedArrayUsingDescriptors:@[sd1, sd2]]; + NSLog(@"%@", sorted); - NSArray *sorted = [strings sortedArrayUsingDescriptors:sortDescriptors]; - NSLog(@"%@", sorted); - - [pool release]; + } return 0; } diff --git a/Task/Sorting-algorithms-Bead-sort/AutoHotkey/sorting-algorithms-bead-sort-1.ahk b/Task/Sorting-algorithms-Bead-sort/AutoHotkey/sorting-algorithms-bead-sort-1.ahk new file mode 100644 index 0000000000..dd0d4bd60c --- /dev/null +++ b/Task/Sorting-algorithms-Bead-sort/AutoHotkey/sorting-algorithms-bead-sort-1.ahk @@ -0,0 +1,24 @@ +BeadSort(data){ + Pole:=[] , TempObj:=[], Result:=[] + for, i, v in data { + Row := i + loop, % v + MaxPole := MaxPole>A_Index?MaxPole:A_Index , Pole[A_Index, row] := 1 + } + + for i , obj in Pole { + TempVar:=0 , c := A_Index + for n, v in obj + TempVar += v + loop, % TempVar + TempObj[c, A_Index] := 1 + } + + loop, % Row { + TempVar:=0 , c := A_Index + Loop, % MaxPole + TempVar += TempObj[A_Index,c] + Result[c] := TempVar + } + return Result +} diff --git a/Task/Sorting-algorithms-Bead-sort/AutoHotkey/sorting-algorithms-bead-sort-2.ahk b/Task/Sorting-algorithms-Bead-sort/AutoHotkey/sorting-algorithms-bead-sort-2.ahk new file mode 100644 index 0000000000..32c2d278df --- /dev/null +++ b/Task/Sorting-algorithms-Bead-sort/AutoHotkey/sorting-algorithms-bead-sort-2.ahk @@ -0,0 +1,3 @@ +for i, val in BeadSort([54,12,87,56,36]) + res := val (res?",":"") res +MsgBox % res diff --git a/Task/Sorting-algorithms-Bead-sort/Clojure/sorting-algorithms-bead-sort.clj b/Task/Sorting-algorithms-Bead-sort/Clojure/sorting-algorithms-bead-sort.clj index 1daa5d308f..9907626063 100644 --- a/Task/Sorting-algorithms-Bead-sort/Clojure/sorting-algorithms-bead-sort.clj +++ b/Task/Sorting-algorithms-Bead-sort/Clojure/sorting-algorithms-bead-sort.clj @@ -1,14 +1,15 @@ (defn transpose [xs] - (loop [transposed [], remaining xs] - (if (empty? remaining) - transposed - (recur - (conj transposed (map #(first %) remaining)) - (filter #(not-empty %) (map #(rest %) remaining)))) )) + (loop [ret [], remain xs] + (if (empty? remain) + ret + (recur (conj ret (map first remain)) + (filter not-empty (map rest remain)))))) (defn bead-sort [xs] - (map #(reduce + %) - (transpose - (transpose (map #(replicate % 1) xs))))) + (->> xs + (map #(repeat 1 %)) + transpose + transpose + (map #(reduce + %)))) -(println (bead-sort [5 2 4 1 3 3 9])) +(-> [5 2 4 1 3 3 9] bead-sort println) diff --git a/Task/Sorting-algorithms-Bubble-sort/Kotlin/sorting-algorithms-bubble-sort.kotlin b/Task/Sorting-algorithms-Bubble-sort/Kotlin/sorting-algorithms-bubble-sort.kotlin new file mode 100644 index 0000000000..7b472a63fb --- /dev/null +++ b/Task/Sorting-algorithms-Bubble-sort/Kotlin/sorting-algorithms-bubble-sort.kotlin @@ -0,0 +1,14 @@ +fun bubbleSort(a : Array , c: Comparator